Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/deploy
2017-05-17 19:05:58 -04:00
..
ansible Tune pgpool variables, we're going fast 2017-05-08 23:42:04 -04:00
.env Add postgres docker support 2017-05-06 18:48:21 -04:00
docker-compose.postgres-prod.yml Automate postgresql setup 2017-05-08 23:42:04 -04:00
docker-compose.postgres.yml Add postgres docker support 2017-05-06 18:48:21 -04:00
docker-compose.sqlite.yml Run sqlite environment in docker 2017-05-06 18:48:21 -04:00
Dockerfile Run sqlite environment in docker 2017-05-06 18:48:21 -04:00
init.sh finish repo transfer 2017-05-17 15:58:40 +10:00
postgres-prod.env Add prod docker files without db 2017-05-06 20:11:47 -04:00
postgres.env Remove nested config variables 2017-05-06 19:02:02 -04:00
prune_docker.sh Add prune script because docker takes up so much space 2017-05-06 18:48:21 -04:00
README.md Start documenting automation 2017-05-17 19:05:58 -04:00
restore.sh Add postgres docker support 2017-05-06 18:48:21 -04:00
sqlite.env Add cache_size param with sqlite backend 2017-05-06 18:48:21 -04:00

Deployment

Docker

The docker-compose files can be used to quickly deploy the website without needing other dependencies than docker and docker-compose.

We offer two database back-end (but that might change to only postgresql later).

NOTE: Use the -prod version to deploy in production. See the section production.

Usage

The first step depends on the back-end chosen.

For the mysql back-end, you need the database file inside the project's top-level directory and named nyaa.db.

For the postgresql back-end, you need the database dump inside the project's top-level directory and named nyaa_psql.backup.

You may now start the container as such.

$ export GOPATH=$HOME/.go
$ mkdir -p $HOME/.go/src/github.com/ewhal
$ cd $HOME/.go/src/github.com/ewhal
$ git clone https://github.com/ewhal/nyaa
$ cd nyaa/deploy
$ docker-compose -f <docker_compose_file> up

The website will be available at http://localhost:9999.

NOTE: The website might crash if the database takes longer than the amount of time sleeping in the init.sh script.

NOTE: The docker-compose file uses version 3, but doesn't yet use any feature from the version 3. If you're getting an error because your version of docker is too low, you can try changing the version to '2' in the compose file.

Production

This is specific to the docker-compose.postgres-prod.yml compose file. This should be used in production.

This setup uses an external postgresql database configured on the host machine instead of using a container. You must therefore install and configure postgresql in order to use this compose file.

Set the correct database parameters in postgres-prod.env. You can then follow the steps above.

Cleaning docker containers

Docker can end up taking a lot of space very quickly. The script prune_docker.sh will get rid of unused docker images and volumes.

Ansible

WIP

$ cd ansible/
$ ansible-playbook -i hosts setup_server.yml