Remove unmaintained Vagrant configuration

This commit is contained in:
Alex Cabal 2021-02-10 16:00:03 -06:00
parent d32c56bb05
commit 8f30ee2530
4 changed files with 5 additions and 183 deletions

View file

@ -1,13 +1,13 @@
# sync-ebooks
To use, call this script with the directory where your ebooks go as its last argument. For example `sync-ebooks /standardebooks.org/ebooks` or if you want to clone them into this repository `sync-ebooks ebooks`. If you want progress output, use -v, and if you want detailed git progress output use -vv. GitHub allows you to make 60 unauthenticated API requests per hour. If you use unauthenticated API requests for other things, this might not be enough, so to resolve that issue, you can create a new OAuth token at https://github.com/settings/tokens/new and pass it via the --token option. You don't need to give the token any permissions.
To use, call this script with the directory where your ebooks go as its last argument. For example `sync-ebooks /standardebooks.org/ebooks`, or if you want to clone them into this repository, `sync-ebooks ebooks`. If you want progress output, use `-v`, and if you want detailed Git progress output use `-vv`. GitHub allows you to make 60 unauthenticated API requests per hour. If you use unauthenticated API requests for other things, this might not be enough, so to resolve that issue, you can create a new OAuth token at `https://github.com/settings/tokens/new` and pass it via the `--token` option. You dont need to give the token any permissions.
# deploy-ebook-to-www
To use, call this script with the directories of the books you want to deploy as its arguments. For example, to deploy all ebooks after using sync-ebooks, run `deploy-ebook-to-www /standardebooks.org/ebooks/*`. To deploy only The Time Machine by H.G Wells, you would run `deploy-ebook-to-www /standardebooks.org/ebooks/h-g-wells_the-time-machine`. To output progress information, use -v or --verbose.
To use, call this script with the directories of the books you want to deploy as its arguments. For example, to deploy all ebooks after using sync-ebooks, run `deploy-ebook-to-www /standardebooks.org/ebooks/*`. To deploy only The Time Machine by H. G. Wells, you would run `deploy-ebook-to-www /standardebooks.org/ebooks/h-g-wells_the-time-machine`. To output progress information, use `-v` or `--verbose`.
The default web root is /standardebooks.org. If it is located elsewhere, specify it with the --webroot option. For instance, `deploy-ebook-to-www --webroot /var/www/html /path/to/ebook`. Note that there will be php errors if the git repositories are not in the ebook directory immediately in the web root. Either keep them there or create a symlink.
The default web root is `/standardebooks.org`. If it is located elsewhere, specify it with the `--webroot` option. For instance, `deploy-ebook-to-www --webroot /var/www/html /path/to/ebook`. Note that there will be php errors if the Git repositories are not in the ebook directory immediately in the web root. Either keep them there or create a symlink.
The default group is se. to use a different one, specify it with the --group option. For instance, to use this script inside the included Vagrant VM, which uses the www-data group, use `deploy-ebook-to-www --group www-data /path/to/ebook`.
The default group is `se`. to use a different one, specify it with the `--group` option.
The default URL is `https://standardebooks.org`. To change it, use the --weburl option. For example, `deploy-ebook-to-www --weburl "http://localhost:8080". This option will cause deploy-ebook-to-www to use the specified URL in the generated opds and rss files. Care should be taken however; the URL `https://standardebooks.org` is hardcoded in a few places, even when `SITE_URL` is changed to a custom URL, so for testing, it may be more convenient to simply use /etc/hosts or a similar mechanism to resolve `standardebooks.org` to `127.0.0.1`.
The default URL is `https://standardebooks.org`. To change it, use the `--weburl` option. For example, `deploy-ebook-to-www --weburl "http://localhost:8080"`. This option will cause `deploy-ebook-to-www` to use the specified URL in the generated OPDS and RSS files. Care should be taken however; the URL `https://standardebooks.org` is hard-coded in a few places, even when `SITE_URL` is changed to a custom URL, so for testing, it may be more convenient to simply use `/etc/hosts` or a similar mechanism to resolve `standardebooks.org` to `127.0.0.1`.

View file

@ -1,122 +0,0 @@
#!/usr/bin/env bash
apt-get update -y
apt-get install -y nginx php-fpm php-apcu php-intl php-mbstring php-xml php-zip composer\
zip unzip git
if [ "$1" = "se-tools" ]
then
cat << "EOF" | su - vagrant -c /bin/bash
#!/bin/bash
set -e
set -o pipefail
# Install some pre-flight dependencies.
sudo apt-get install -y python3-pip libxml2-utils librsvg2-bin libimage-exiftool-perl imagemagick jarwrapper default-jre inkscape calibre curl\
firefox
# Install required fonts.
mkdir -p ~/.local/share/fonts/
curl -s -o ~/.local/share/fonts/LeagueSpartan-Bold.otf "https://raw.githubusercontent.com/theleagueof/league-spartan/master/LeagueSpartan-Bold.otf"
curl -s -o ~/.local/share/fonts/OFLGoudyStM.otf "https://raw.githubusercontent.com/theleagueof/sorts-mill-goudy/master/OFLGoudyStM.otf"
curl -s -o ~/.local/share/fonts/OFLGoudyStM-Italic.otf "https://raw.githubusercontent.com/theleagueof/sorts-mill-goudy/master/OFLGoudyStM-Italic.otf"
# Refresh the local font cache.
sudo fc-cache -f
rm -rf ~/.local/share/epubcheck
epubcheck_download_url=$(curl https://api.github.com/repos/w3c/epubcheck/releases/latest \
| grep -E --only-matching "\"browser_download_url\":\s*\"(.*?)\"" \
| sed "s/\"browser_download_url\":\s*//g" | sed "s/\"//g")
if [ ! -f ~/.epubcheck_version ] || ! grep -q "${epubcheck_download_url}" ~/.epubcheck_version; then
# Download and install the required version of epubcheck.
wget --quiet -O /tmp/epubcheck.zip "${epubcheck_download_url}"
unzip -o -d $HOME/.local/share/ /tmp/epubcheck.zip
mv -f $HOME/.local/share/epubcheck-* $HOME/.local/share/epubcheck
sudo chmod +x $HOME/.local/share/epubcheck/epubcheck.jar
sudo ln -fs $HOME/.local/share/epubcheck/epubcheck.jar /usr/local/bin/epubcheck
printf "%s" "${epubcheck_download_url}" > ~/.epubcheck_version
fi
# Install the toolset.
pip3 install --upgrade standardebooks
# Install tab completion.
sudo ln -fs $HOME/.local/lib/python3.*/site-packages/se/completions/bash/se /usr/share/bash-completion/completions/se
echo "se has been installed to '~/.local/bin'. It should be in your path."
EOF
fi
cat << "EOF" > /etc/php/7.2/fpm/conf.d/99-standardebooks.ini
include_path = .:/standardebooks.org/lib
short_open_tag = On
extension = apcu
extension = intl
#display_errors = On
#display_startup_errors = On
EOF
sed -i "s/short_open_tag = Off/short_open_tag = On/g" /etc/php/7.2/cli/php.ini
cat << "EOF" > /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /standardebooks.org/web/www;
index index.php index.html index.htm index.xml index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ @extensionless-php;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
rewrite ^/ebooks/([^\./]+?)/$ /ebooks/author.php?url-path=$1;
rewrite ^/ebooks/([^\.]+?)/?$ /ebooks/ebook.php?url-path=$1;
rewrite ^/tags/([^\./]+?)/?$ /ebooks/index.php?tag=$1;
rewrite ^/collections/([^\./]+?)/?$ /ebooks/index.php?collection=$1;
rewrite ^/images/covers/([^\./]+?)-[0-9a-f]+-cover([^\./]+).jpg$ /images/covers/$1-cover$2.jpg;
rewrite ^/images/covers/([^\./]+?)-[0-9a-f]+-hero([^\./]+).jpg$ /images/covers/$1-hero$2.jpg;
rewrite ^/rss/new-releases/?$ /rss/new-releases.xml;
}
EOF
cat << "EOF" | su - vagrant -c /bin/bash
#!/bin/bash
set -e
set -o pipefail
if ! grep "^export PATH=$PATH:~/.local/bin$" ~/.bashrc; then
printf '\nexport PATH=$PATH:~/.local/bin' >> ~/.bashrc
fi
ln -fs /standardebooks.org/scripts/sync-ebooks ~/.local/bin/sync-ebooks
ln -fs /standardebooks.org/web/scripts/deploy-ebook-to-www ~/.local/bin/deploy-ebook-to-www
EOF
chown -R www-data:www-data /var/www
su - www-data -s /bin/sh -c "cd /standardebooks.org/; composer install"
usermod -a -G www-data vagrant
systemctl enable php7.2-fpm
systemctl enable nginx
systemctl restart php7.2-fpm
systemctl restart nginx