~starkingdoms/starkingdoms

089a5575d1dda133ba34d4fb00f4fef52a3da0b4 — core 2 years ago 43fe824
build assets with compiling the client
2 files changed, 47 insertions(+), 1 deletions(-)

M .gitignore
A docker/nginx.conf
M .gitignore => .gitignore +3 -1
@@ 6,4 6,6 @@ assets/svg/*.png
build.ninja
.ninja_log
api/config.toml
api/.env
\ No newline at end of file
api/.env
assets/dist
assets/final
\ No newline at end of file

A docker/nginx.conf => docker/nginx.conf +44 -0
@@ 0,0 1,44 @@
# This is the nginx config that we (starkingdoms) use in production.
# To use this for yourself, replace `YOURDOMAIN` with your domain (ie: starkingdoms.io, bleeding.starkingdoms.io, etc)
# and replace YOURSERVERIP with the IP that the server is hosted on (for local, use 127.0.0.1)
# Ports are the same as the ones deployed by the scripts in /ansible/.
# You can use this as a guide to write your own config. Be aware that the game will not function very well if there is
# high CPU usage on the proxy server, as nginx will struggle to proxy the websocket connection.
# Put this on an at-least-semi-decent server.
# Game pings, game stream and static assets are on the primary domain (ex: bleeding.starkingdoms.io)
server {
        server_name YOURDOMAIN;

        # Static assets should be routed to the nginx container which can handle the traffic
        location / {
                proxy_set_header Host $host;    # Very important (security, logins will break without this), do not remove
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://YOURSERVERIP:3206; # Web port is 3206 with the provided ansible files
        }

        # Websockets should be upgraded and forwarded to the game server
        location /ws {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_http_version 1.1;
                proxy_set_header Connection "Upgrade";
                proxy_set_header Upgrade $http_upgrade;
                proxy_pass http://YOURSERVERIP:3204; # Game server is 3204 with the provided ansible files
        }
        # Pings to the game server should be routed there too
        location /ping {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://YOURSERVERIP:3204;
        }
}
# API is on a secondary domain (api.bleeding.starkingdoms.io)
server {
        server_name api.YOURDOMAIN.COM;

        location / {
                proxy_set_header Host $host;                                    # Very important (security), do not remove
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    # Very important (security), do not remove
                proxy_pass http://YOURSERVERIP:3205; # API server is 3205 with the provided ansible files
        }
}
\ No newline at end of file