4.5 KiB
This assumes that you have Docker (version 17.05 or greater) and Docker Compose (version 1.6.0 or greater) already installed.
Prepare things
-
Download the
szuruboorusource:user@host:~$ git clone https://github.com/rr-/szurubooru.git szuru user@host:~$ cd szuru -
Configure the application:
user@host:szuru$ cp server/config.yaml.dist server/config.yaml user@host:szuru$ edit server/config.yamlPay extra attention to these fields:
- secret
- the
smtpsection.
You can omit lines when you want to use the defaults of that field.
-
Configure Docker Compose:
user@host:szuru$ cp doc/example.env .env user@host:szuru$ edit .envChange the values of the variables in
.envas needed. Read the comments to guide you. Note that.envshould be in the root directory of this repository.
Running the Application
-
Configurations for ElasticSearch:
You may need to raise the
vm.max_map_countparameter to at least262144in order for the ElasticSearch container to function. Instructions on how to do so are provided here. -
Running the application
Download containers:
user@host:szuru$ docker-compose pullFor first run, it is reccomended to start the databases seperately:
user@host:szuru$ docker-compose up -d elasticsearch user@host:szuru$ docker-compose up -d sqlThen wait approx. 2 minutes before starting all containers. This gives time for the databases to initalize their storage structure.
To start all containers:
user@host:szuru$ docker-compose up -dTo view/monitor the application logs:
user@host:szuru$ docker-compose logs -f # (CTRL+C to exit)To stop all containers:
user@host:szuru$ docker-compose down
Additional Features
-
CLI-level administrative tools
You can use the included
szuru-adminscript to perform various administrative tasks such as changing or resetting a user password. To run from docker:user@host:szuru$ docker-compose run api ./szuru-admin --helpwill give you a breakdown on all available commands.
-
Using a seperate domain to host static files (image content)
If you want to host your website on, (
http://example.com/) but want to serve the images on a different domain, (http://static.example.com/) then you can run the backend container with an additional environment variableDATA_URL=http://static.example.com/. Make sure that this additional host has access contents to the/datavolume mounted in the backend. -
Setting a specific base URI for proxying
Some users may wish to access the service at a different base URI, such as
http://example.com/szuru/, commonly when sharing multiple HTTP services on one domain using a reverse proxy. In this case, simply setBASE_URL="/szuru/"in your.envfile.Note that this will require a reverse proxy to function. You should set your reverse proxy to proxy
http(s)://example.com/szurutohttp://<internal IP or hostname of frontend container>/. For an NGINX reverse proxy, that will appear as:location /szuru { proxy_http_version 1.1; proxy_pass http://<internal IP or hostname of frontend container>/; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Script-Name /szuru; } -
Preparing for production
If you plan on using szurubooru in a production setting, you may opt to use a reverse proxy for added security and caching capabilities. Start by having the client docker listen only on localhost by changing
PORTin your.envfile to127.0.0.1:8080instead of simply:8080. Then configure NGINX (or your caching/reverse proxy server of your choice) to proxy_passhttp://127.0.0.1:8080. We've also included an example config.