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

@ -180,50 +180,3 @@ Before submitting design contributions, please discuss them with the Standard Eb
else
print('Bar!');
````
# Vagrant
You can also set up a development server running Ubuntu 18.04 with nginx and php-fpm by using the included Vagrantfile in the project root. To do so, first install Vagrant and VirtualBox.
Both are available as packages in several major distributions, including Arch, Debian, Fedora, Gentoo, Ubuntu, and NixOS among others. Note that [the official docs advise against installing from distribution repositories](https://www.vagrantup.com/intro/getting-started/install.html) due to potentially old versions or incorrect dependencies.
If you want to download the official binaries because Vagrant is not available in your distros repository, because the version in the repository is too old or broken, or because you do not use Linux, you can download Vagrant [here](https://www.vagrantup.com/downloads.html)
and VirtualBox from [here.](https://www.virtualbox.org/wiki/Downloads)
After you have installed both, you can start and manage a VM running a server like this:
- `vagrant box add ubuntu/bionic64` downloads an [official Ubuntu 18.04 image](https://app.vagrantup.com/ubuntu/boxes/bionic64) (also known as a box in Vagrant terminology) for use as a base image in Vagrant VMs. This box is stored in `$HOME/.vagrant.d/boxes`.
- `vagrant run` will launch a VirtualBox VM running the server. (Note: newer versions of Vagrant, such as the one found on Arch, use `up` instead of `run`.)
* On its first invocation, or when the VM has been deleted, `vagrant up` will create a new VirtualBox VM in your standard Virtualbox machine directory (usually `$HOME/VirtualBox VMs`) using the previously added box as a base and configure it using the `Vagrantfile` and `scripts/provision.sh`. This means that the first time doing `vagrant run` will take significantly longer than following invocations because those simply start up the already created VM associated with VirtualBox.
* Note that `vagrant run` will automatically download the box specified in the Vagrantfile (in this case `ubuntu/bionic64`), so you can skip `vagrant box add ubuntu/bionic64` if you want.
- The project root is mounted in the VM as `/standardebooks.org/`, so any changes you make in the repository will be reflected in the webroot inside VM. However, you may have to restart the server for it to pick up the changes. You can restart the entire VM by doing `vagrant reload` or you can use `vagrant ssh -c "sudo systemctl restart php7.2-fpm; sudo systemctl restart nginx;"` to restart php-fpm and nginx.
- You can run commands inside the VM with `vagrant ssh -c COMMAND` or launch an interactive SSH session with `vagrant ssh`.
- When you are done, you can shut down the VM by doing `vagrant halt`. To start it again, do `vagrant run`.
- To delete the project-local VirtualBox VM, run `vagrant destroy`. To get a fresh VM, for example, you can do `vagrant destroy` followed by `vagrant up`. Note that this does not delete any added boxes/base images added with `vagrant box add`.
## Some further notes
- The Vagrant script will install [se](https://standardebooks.org/tools) by default. If you dont want that (it pulls in quite a few dependencies), remove the `se-tools` argument in Vagrantfile.
- `se`, if installed in the VM, and /standardebooks.org/scripts are in the VMs path. This means you can easily use them with `vagrant ssh -c` like this: `vagrant ssh -c "sync-ebooks -vv /standardebooks.org/ebooks; deploy-ebook-to-www -v --group www-data /standardebooks.org/ebooks/*"`, which would populate the test server with all available SE ebooks.
- It is safe to re-run the provision script if you did not change the nginx or php configuration files (change the files in the provision script and re-provision instead), so you can use `vagrant up --provision` or `vagrant reload --provision to update the VM, including se-tools and epubcheck, without having to delete it.
- The server runs on `127.0.0.1:8080` if you want to use a different port, change the `host: 8080` statement in the Vagrantfile to the desired port.
- You can list all locally installed boxes by doing `vagrant box list`.
- To completely delete a box, you can run `vagrant box remove ubuntu/bionic64`.
- To update the box, run `vagrant box update --box ubuntu/bionic64`. Note that this will not change the project-local VM. You will have to create a new VM based on the updated box by doing a `vagrant destroy` followed by a `vagrant up`. To remove old unused versions of boxes, run `vagrant box prune`.
- Check out scripts/provision.sh to see how the server is configured, the script is Vagrant-agnostic, so it should be helpful even if you dont want to use Vagrant.
- For further information, check out the [official Vagrant guide.](https://www.vagrantup.com/intro/index.html)