Skip to content

Deployment

httpjamesm edited this page Sep 24, 2023 · 4 revisions

The more hosted instances of AnonymousOverflow we have, the better load will be balanced between them all, leading to a better experience for everyone.

Alternative: Use the community pre-built Docker image

Alternative: Use the community pre-built Docker image

Follow the documentation here: https://codeberg.org/aryak/-/packages/container/anonymousoverflow-docker-builds/latest.

⚠️ This is an unofficial build and is not maintained by the maintainers of AnonymousOverflow.

Alternative: Build the project yourself

Alternative: Build the project yourself

  1. Find a directory to put AnonymousOverflow's source code.
  2. Clone the repo with git clone https://github.com/httpjamesm/AnonymousOverflow.

Setup Compose

AnonymousOverflow provides an example docker-compose file in docker-compose.example.yml. This defines the setup for the container.

  1. Copy it to docker-compose.yml using cp docker-compose.example.yml docker-compose.yml.
  2. Modify ports if needed.
    • Usually you want to edit the ports: section to meet your needs, especially if you're using a reverse proxy, like nginx. Try replacing the - 80:8080 part with - host:port:8080.
  3. Modify environment: to fit your setup.

Build and deploy

In the same directory as the docker-compose.yml file, run docker compose up -d --build to run the container in the background as a daemon (-d) and compile it (--build).

Pre-requisites

  • Server or an always-on computer
  • Fast internet connection

Dependencies

AnonymousOverflow is deployed using Docker. Docker containerizes the app for a more convenient and secure deployment.

Install Docker

If you don't have Docker already, follow the official documentation to install the engine.

Use the official pre-built Docker image

  1. Find a directory to put a configuration file.

Setup Compose

AnonymousOverflow provides an example docker-compose file in docker-compose.example.yml. This defines the setup for the container.

  1. Copy it to docker-compose.yml using cp docker-compose.example.yml docker-compose.yml.
  2. Modify ports if needed.
    • Usually you want to edit the ports: section to meet your needs, especially if you're using a reverse proxy, like nginx. Try replacing the - 80:8080 part with - host:port:8080.
  3. Modify environment: to fit your setup.

Deploy

In the same directory as the docker-compose.yml file, run docker compose up -d to pull the latest release and run the container in the background as a daemon (-d).

Optional: Place a reverse proxy in front of it

Reverse proxies are especially useful if you want to run multiple services on your machine. nginx is recommended.

Install nginx

You can install it for your operating system according to the official documentation.

Setup the config file

Depending on your operating system, this path may differ, but usually configs are stored in /etc/nginx/sites-enabled. Navigate to this directory and create a new file called <domain>.conf.

In this file, put the following:

server {
        listen 443 ssl;

        server_name domain;

        ssl_certificate /etc/ssl/cert.pem;
        ssl_certificate_key /etc/ssl/key.pem;

        location / {
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_pass http://host:port;
        }

}

$remote_addr is passed to the app via X-Forwarded-For to enforce the anti-scraping ratelimit properly. If you remove this block, it may block access globally if your instance is abused.

Reload

Run nginx -t to test your config. If all is ok, it should print the following:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If there are no issues, reload using nginx -s reload.