diff --git a/docs/prod.md b/docs/prod.md new file mode 100644 index 0000000..2967679 --- /dev/null +++ b/docs/prod.md @@ -0,0 +1,35 @@ +# ARTEMiS Production mode +Production mode is a configuration option that changes how the server listens to be more friendly to a production environment. This mode assumes that a proxy (for this guide, nginx) is standing in front of the server to handle port mapping and TLS. In order to activate production mode, simply change `is_develop` to `False` in `core.yaml`. Next time you start the server, you should see "Starting server in production mode". + +## Nginx Configuration +### Port forwarding +Artemis requires that the following ports be forwarded to allow internet traffic to access the server. This will not change regardless of what you set in the config, as many of these ports are hard-coded in the games. +`tcp:80` all.net, non-ssl titles +`tcp:8443` billing +`tcp:22345` aimedb +`tcp:443` frontend, SSL titles + +### A note about external proxy services (cloudflare, etc) +Due to the way that artemis functions, it is currently not possible to put the server behind something like Cloudflare. Cloudflare only proxies web traffic on the standard ports (80, 443) and, as shown above, this does not work with artemis. Server administrators should seek other means to protect their network (VPS hosting, VPN, etc) + +### Port mappings +An example config is provided in the `config` folder called `nginx_example.conf`. It is set up for the following: +`naominet.jp:tcp:80` -> `localhost:tcp:8000` for allnet +`ib.naominet.jp:ssl:8443` -> `localhost:tcp:8444` for the billing server +`your.hostname.here:ssl:443` -> `localhost:tcp:8080` for the SSL title server +`your.hostname.here:tcp:80` -> `localhost:tcp:8080` for the non-SSL title server +`cxb.hostname.here:ssl:443` -> `localhost:tcp:8080` for crossbeats (appends /SDCA/104/ to the request) +`pokken.hostname.here:ssl:443` -> `localhost:tcp:8080` for pokken +`frontend.hostname.here:ssl:443` -> `localhost:tcp:8090` for the frontend, includes https redirection + +If you're using this as a guide, be sure to replace your.hostname.here with the hostname you specified in core.yaml under `titles->hostname`. Do *not* change naominet.jp, or allnet/billing will fail. Also remember to specifiy certificat paths correctly, as in the example they are simply placeholders. + +### Multi-service ports +It is possible to use nginx to redirect billing and title server requests to the same port that all.net uses. By setting `port` to 0 under billing and title server, you can change the nginx config to serve the following (entries not shown here should be the same) +`ib.naominet.jp:ssl:8443` -> `localhost:tcp:8000` for the billing server +`your.hostname.here:ssl:443` -> `localhost:tcp:8000` for the SSL title server +`your.hostname.here:tcp:80` -> `localhost:tcp:8000` for the non-SSL title server +`cxb.hostname.here:ssl:443` -> `localhost:tcp:8000` for crossbeats (appends /SDCA/104/ to the request) +`pokken.hostname.here:ssl:443` -> `localhost:tcp:8000` for pokken + +This will allow you to only use 3 ports locally, but you will still need to forward the same internet-facing ports as before. \ No newline at end of file diff --git a/example_config/nginx_example.conf b/example_config/nginx_example.conf index 30c733c..fe6f7a7 100644 --- a/example_config/nginx_example.conf +++ b/example_config/nginx_example.conf @@ -114,6 +114,7 @@ server { # Frontend HTTPS. Comment out if you on't intend to use the frontend server { listen 443 ssl; + server_name frontend.hostname.here; ssl_certificate /path/to/cert/frontend.pem; ssl_certificate_key /path/to/cert/frontend.key;