baseline: OpenMU upstream b5a0961 (fresh source)
This commit is contained in:
90
deploy/README.md
Normal file
90
deploy/README.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Deployment
|
||||
|
||||
The recommended way to deploy OpenMU is through Docker. Depending on the scale
|
||||
you need, we have multiple ways to do that.
|
||||
|
||||
## All-in-one
|
||||
|
||||
The [all-in-one deployment](/all-in-one/) is recommended, if you want to host on
|
||||
a small machine with a low amount of players.
|
||||
In this case, all kinds of OpenMU subsystems (ConnectServer, GameServer, LoginServer,
|
||||
AdminPanel, ...) are running in one process.
|
||||
|
||||
### Pros
|
||||
|
||||
* No communication overhead between subsystems, therefore slightly faster
|
||||
* Simpler deployment
|
||||
* Smaller memory footprint. Since we run all in one process, we don't have the
|
||||
overhead of multiple processes, runtimes and can share data.
|
||||
* Easier to observe and debug, no additional tools required
|
||||
|
||||
### Cons
|
||||
|
||||
* Harder to scale - only by scaling up your single machine
|
||||
* Lower resiliency. If one subsystem crashes the process, the whole thing goes
|
||||
down
|
||||
* It's a more or less self-contained system which is harder to extend
|
||||
|
||||
## All-in-one with Traefik as Reverse Proxy
|
||||
|
||||
The [all-in-one with traefik deployment](/deploy/all-in-one-traefik/) is recommended,
|
||||
if you want to host on a small machine with a low amount of players and want to host
|
||||
your MuOnline Website on the same machine.
|
||||
|
||||
Once Traefik works as a Reverse Proxy, you can handle miltiple website without
|
||||
change the default port to HTTP/HTTPS connections.
|
||||
|
||||
Addin a few labels to your container, you will tell Traefik how to handle incoming
|
||||
requests and he will redirect to the correct website.
|
||||
|
||||
### Pros
|
||||
|
||||
* No communication overhead between subsystems, therefore slightly faster
|
||||
* Simpler deployment
|
||||
* Smaller memory footprint. Since we run all in one process, we don't have the
|
||||
overhead of multiple processes, runtimes and can share data.
|
||||
* Easier to observe and debug, no additional tools required
|
||||
* You can have multi websites with auto renew SSL Certificates
|
||||
* Expose only 80 and 443 ports for websites and admin panel.
|
||||
Traefik knows what to do
|
||||
|
||||
### Cons
|
||||
|
||||
* Harder to scale - only by scaling up your single machine
|
||||
* Lower resiliency. If one subsystem crashes the process, the whole thing goes
|
||||
down
|
||||
* It's a more or less self-contained system which is harder to extend
|
||||
|
||||
## Distributed
|
||||
|
||||
*!!! CURRENTLY BROKEN AND UNSUPPORTED, DOCS ARE OUT OF DATE !!!*
|
||||
|
||||
It's also possible to host OpenMU in a [distributed](/distributed/) way.
|
||||
However, this introduces a lot more complexity and you should know what you're doing.
|
||||
The communication between the subsystems is handled with Dapr.
|
||||
|
||||
Warnings:
|
||||
|
||||
* It's currently unsupported due to several issues we have to resolve first.
|
||||
Feel free to contribute for the following issues: <https://github.com/MUnique/OpenMU/issues?q=is%3Aissue%20state%3Aopen%20label%3Adistributed-deployment>
|
||||
* This way of hosting OpenMU is more complex and requires a good understanding
|
||||
of distributed systems.
|
||||
* This deployment requires more resources (CPU, RAM, Disk, Network).
|
||||
|
||||
### Pros
|
||||
|
||||
* Easier to scale. For example, if you need additional game servers you simply
|
||||
add more containers.
|
||||
* Higher resiliency. If one subsystem crashes, the others are not affected.
|
||||
* It's easier to add more subsystems, even custom ones.
|
||||
For example, one could subscribe on already published events like guild messages
|
||||
or letters.
|
||||
Such a subsystem could forward messages to other systems (E-Mail, Discord, etc.).
|
||||
|
||||
### Cons
|
||||
|
||||
* Communication overhead between subsystems.
|
||||
* Higher memory footprint, since we run multiple docker containers
|
||||
(each with their own .net runtime) which can't share some data.
|
||||
* Harder to observe and debug. We added some stuff to compensate that (Loki,
|
||||
Grafana, Prometheus, Zipkin), but they require additional resources, too.
|
||||
25
deploy/all-in-one-traefik/.dockerignore
Normal file
25
deploy/all-in-one-traefik/.dockerignore
Normal file
@@ -0,0 +1,25 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
1
deploy/all-in-one-traefik/.env.example
Normal file
1
deploy/all-in-one-traefik/.env.example
Normal file
@@ -0,0 +1 @@
|
||||
DOMAIN=domain.com
|
||||
2
deploy/all-in-one-traefik/.gitignore
vendored
Normal file
2
deploy/all-in-one-traefik/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
data-traefik/acme.json
|
||||
.env
|
||||
7
deploy/all-in-one-traefik/.htpasswd
Normal file
7
deploy/all-in-one-traefik/.htpasswd
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file contains the passwords for the admin panel and tracing.
|
||||
# Change these passwords in production!
|
||||
# default is admin:openmu, hashed with bcrypt.
|
||||
|
||||
admin:$2y$10$xYL2d/QEukwGmX0uNZubsunL0qcANuTYkpapRVdlu5q3ymCpvOEh.
|
||||
|
||||
# this file should always end with an empty line!
|
||||
140
deploy/all-in-one-traefik/README.md
Normal file
140
deploy/all-in-one-traefik/README.md
Normal file
@@ -0,0 +1,140 @@
|
||||
# All-in-one-traefik deployment
|
||||
|
||||
The all in one (with traefik) deployment is recommended, if you want to host
|
||||
on a small machine with a low amount of players and want to host your
|
||||
MuOnline Website on the same machine.
|
||||
|
||||
Once Traefik works as a Reverse Proxy, you can handle multiple websites
|
||||
without changing the default port to HTTP/HTTPS connections.
|
||||
|
||||
Adding a few labels to your container, you will tell Traefik how to
|
||||
handle incoming requests and it will redirect to the correct website.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
admin-panel:
|
||||
...
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy"
|
||||
- "traefik.http.routers.adm.entrypoints=websecure"
|
||||
- "traefik.http.routers.adm.rule=Host(`admin.domain.com`)"
|
||||
- "traefik.http.routers.adm.middlewares=auth"
|
||||
- "traefik.http.middlewares.auth.basicauth.usersfile=.htpasswd"
|
||||
|
||||
muonline-website:
|
||||
...
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy"
|
||||
- "traefik.http.routers.muonline.entrypoints=websecure"
|
||||
- "traefik.http.routers.muonline.rule=Host(`muonline.domain.com`)"
|
||||
```
|
||||
|
||||
You can even add multiple domains and/or subdomains to your host label
|
||||
|
||||
``` yaml
|
||||
- "traefik.http.routers.muonline.rule=Host(`www.domain1.com`,`domain1.com`,`sub.domain1.com`)"
|
||||
```
|
||||
|
||||
In this case, all kinds of OpenMU subsystems (ConnectServer, GameServer, LoginServer,
|
||||
AdminPanel, ...) are running in one process, but you can run
|
||||
AdminPanel and other websites separately.
|
||||
|
||||
## Deployment with docker-compose
|
||||
|
||||
### Install GIT
|
||||
|
||||
See [https://github.com/git-guides/install-git](https://github.com/git-guides/install-git).
|
||||
|
||||
### Clone the repository
|
||||
|
||||
``` bash
|
||||
git clone https://github.com/MUnique/OpenMU.git
|
||||
```
|
||||
|
||||
It will create a new folder OpenMU with the repository contents inside.
|
||||
|
||||
### Navigate to the docker-compose files
|
||||
|
||||
Navigate to the folder `deploy/all-in-one-traefik`
|
||||
|
||||
``` bash
|
||||
cd deploy/all-in-one-traefik
|
||||
```
|
||||
|
||||
### Create a new docker network
|
||||
|
||||
You need to have communication between containers from different docker compose files
|
||||
|
||||
``` bash
|
||||
docker network create proxy
|
||||
```
|
||||
|
||||
### Option A - for local testing
|
||||
|
||||
To run the official docker image on your local traefik server, just run:
|
||||
|
||||
``` bash
|
||||
docker compose -f docker-compose.yml up -d
|
||||
```
|
||||
|
||||
And that's it. It's then available on your local computer through a loopback
|
||||
ip. Your AdminPanel URL is `http://admin.docker.localhost`. You can change it
|
||||
in the `docker-compose.yml` file.
|
||||
|
||||
However, if you want to make it available through the internet, you should choose
|
||||
Option B:
|
||||
|
||||
### Option B - with HTTPS
|
||||
|
||||
If you want to share your server with the world, it's recommended to set up HTTPS
|
||||
and Traefik can handle it for you. Otherwise, traffic from and to the admin
|
||||
panel is not encrypted.
|
||||
|
||||
#### Set your domain name as environment variable
|
||||
|
||||
Make a copy of `.env.example` called `.env` and edit the `.env` file with your
|
||||
domain/subdomain to the AdminPanel URL.
|
||||
|
||||
``` bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Make a copy of `data-traefik/acme.example.json` called `data-traefik/acme.json`
|
||||
and apply permission 600 to `acme.json`
|
||||
|
||||
``` bash
|
||||
cp data-traefik/acme.example.json data-traefik/acme.json
|
||||
chmod 600 data-traefik/acme.json
|
||||
```
|
||||
|
||||
#### Run it
|
||||
|
||||
``` bash
|
||||
docker compose -f docker-compose.prod.yml up -d
|
||||
```
|
||||
|
||||
#### Important
|
||||
|
||||
Avoid editing the .htpasswd manually. Instead, access the admin panel
|
||||
and add a new user. If you are using the _all-in-one-traefik_ you
|
||||
need to restart Traefik after add a new user to it takes effect.
|
||||
|
||||
## What's next
|
||||
|
||||
The server is automatically started and initialized for Season 6. You can start
|
||||
playing, if you want :-)
|
||||
|
||||
Additionally, take a look at the AdminPanel.
|
||||
|
||||
If your containers run on docker at your local machine, you can simply go to `http://admin.docker.localhost/`.
|
||||
The default username is 'admin', the password 'openmu'. You should change that later.
|
||||
|
||||
If you want to run another game version, you can go to the setup page through
|
||||
the navigation menu, where you can select your desired game version,
|
||||
number of game servers (just the data of it), and if test accounts
|
||||
should be created.
|
||||
|
||||
If you click on 'Install', wait a bit until the database is set up and
|
||||
filled with the data and voila, OpenMU is ready to use.
|
||||
@@ -0,0 +1,26 @@
|
||||
# Dynamic configuration
|
||||
http:
|
||||
middlewares:
|
||||
nofloc:
|
||||
headers:
|
||||
customResponseHeaders:
|
||||
Permissions-Policy: "interest-cohort=()"
|
||||
secureHeaders:
|
||||
headers:
|
||||
sslRedirect: true
|
||||
forceSTSHeader: true
|
||||
stsIncludeSubdomains: true
|
||||
stsPreload: true
|
||||
stsSeconds: 31536000
|
||||
|
||||
tls:
|
||||
options:
|
||||
default:
|
||||
cipherSuites:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
|
||||
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
|
||||
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
|
||||
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
|
||||
minVersion: VersionTLS12
|
||||
47
deploy/all-in-one-traefik/data-traefik/traefik.yml
Normal file
47
deploy/all-in-one-traefik/data-traefik/traefik.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
api:
|
||||
dashboard: true
|
||||
|
||||
entryPoints:
|
||||
web:
|
||||
address: :80
|
||||
http:
|
||||
redirections:
|
||||
entryPoint:
|
||||
to: websecure
|
||||
|
||||
websecure:
|
||||
address: :443
|
||||
http:
|
||||
middlewares:
|
||||
- secureHeaders@file
|
||||
- nofloc@file
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
|
||||
pilot:
|
||||
dashboard: false
|
||||
|
||||
providers:
|
||||
docker:
|
||||
endpoint: "unix:///var/run/docker.sock"
|
||||
exposedByDefault: false
|
||||
file:
|
||||
filename: /configurations/dynamic.yml
|
||||
|
||||
certificatesResolvers:
|
||||
letsencrypt:
|
||||
acme:
|
||||
email: admin@domain.com
|
||||
storage: acme.json
|
||||
keyType: EC384
|
||||
httpChallenge:
|
||||
entryPoint: web
|
||||
|
||||
buypass:
|
||||
acme:
|
||||
email: admin@domain.com
|
||||
storage: acme.json
|
||||
caServer: https://api.buypass.com/acme/directory
|
||||
keyType: EC256
|
||||
httpChallenge:
|
||||
entryPoint: web
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectGuid>4430d6a8-54b5-412b-9dba-07b3e3580af7</ProjectGuid>
|
||||
<DockerLaunchAction>None</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DockerServiceName>openmu-startup-traefik</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".env.example" />
|
||||
<None Include="docker-compose.yml">
|
||||
</None>
|
||||
<None Include="docker-compose.prod.yml">
|
||||
</None>
|
||||
<None Include=".dockerignore" />
|
||||
<None Include=".gitignore" />
|
||||
<None Include=".htpasswd" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
71
deploy/all-in-one-traefik/docker-compose.prod.yml
Normal file
71
deploy/all-in-one-traefik/docker-compose.prod.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
services:
|
||||
openmu-startup:
|
||||
image: munique/openmu
|
||||
container_name: openmu-startup
|
||||
networks:
|
||||
- proxy
|
||||
ports:
|
||||
- "55901:55901"
|
||||
- "55902:55902"
|
||||
- "55903:55903"
|
||||
- "55904:55904"
|
||||
- "55905:55905"
|
||||
- "55906:55906"
|
||||
- "44405:44405"
|
||||
- "55980:55980"
|
||||
environment:
|
||||
DB_HOST: database
|
||||
working_dir: /app/
|
||||
volumes:
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
depends_on:
|
||||
- database
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy"
|
||||
- "traefik.http.routers.openmu.entrypoints=websecure"
|
||||
- "traefik.http.routers.openmu.rule=Host(`${DOMAIN}`)"
|
||||
- "traefik.http.routers.openmu.middlewares=auth"
|
||||
- "traefik.http.middlewares.auth.basicauth.usersfile=.htpasswd"
|
||||
|
||||
database:
|
||||
image: postgres
|
||||
container_name: database
|
||||
environment:
|
||||
POSTGRES_PASSWORD: admin
|
||||
POSTGRES_DB: openmu
|
||||
POSTGRES_USER: postgres
|
||||
networks:
|
||||
- proxy
|
||||
ports:
|
||||
- "5432"
|
||||
volumes:
|
||||
- dbdata:/var/lib/postgresql #store data on volume
|
||||
|
||||
traefik:
|
||||
image: traefik
|
||||
container_name: traefik
|
||||
restart: always
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- ./data-traefik/traefik.yml:/traefik.yml:ro
|
||||
- ./data-traefik/acme.json:/acme.json
|
||||
- ./data-traefik/configurations:/configurations
|
||||
- "./.htpasswd:/.htpasswd"
|
||||
networks:
|
||||
- proxy
|
||||
labels:
|
||||
- "traefik.docker.network=proxy"
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
dbdata:
|
||||
68
deploy/all-in-one-traefik/docker-compose.yml
Normal file
68
deploy/all-in-one-traefik/docker-compose.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
services:
|
||||
openmu-startup:
|
||||
image: munique/openmu
|
||||
container_name: openmu-startup
|
||||
networks:
|
||||
- proxy
|
||||
ports:
|
||||
- "55901:55901"
|
||||
- "55902:55902"
|
||||
- "55903:55903"
|
||||
- "55904:55904"
|
||||
- "55905:55905"
|
||||
- "55906:55906"
|
||||
- "44405:44405"
|
||||
- "55980:55980"
|
||||
environment:
|
||||
DB_HOST: database
|
||||
working_dir: /app/
|
||||
volumes:
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
depends_on:
|
||||
- database
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy"
|
||||
- "traefik.http.routers.openmu.entrypoints=web"
|
||||
- "traefik.http.routers.openmu.rule=Host(`admin.docker.localhost`)"
|
||||
- "traefik.http.routers.openmu.middlewares=auth"
|
||||
- "traefik.http.middlewares.auth.basicauth.usersfile=.htpasswd"
|
||||
|
||||
database:
|
||||
image: postgres
|
||||
container_name: database
|
||||
environment:
|
||||
POSTGRES_PASSWORD: admin
|
||||
POSTGRES_DB: openmu
|
||||
POSTGRES_USER: postgres
|
||||
networks:
|
||||
- proxy
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- dbdata:/var/lib/postgresql #store data on volume
|
||||
|
||||
traefik:
|
||||
image: "traefik"
|
||||
container_name: "traefik"
|
||||
restart: always
|
||||
command:
|
||||
- "--log.level=DEBUG"
|
||||
- "--api.insecure=true"
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--entrypoints.web.address=:80"
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
- "./.htpasswd:/.htpasswd"
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
dbdata:
|
||||
25
deploy/all-in-one/.dockerignore
Normal file
25
deploy/all-in-one/.dockerignore
Normal file
@@ -0,0 +1,25 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
7
deploy/all-in-one/.htpasswd
Normal file
7
deploy/all-in-one/.htpasswd
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file contains the passwords for the admin panel and tracing.
|
||||
# Change these passwords in production!
|
||||
# default is admin:openmu, hashed with bcrypt.
|
||||
|
||||
admin:$2y$10$xYL2d/QEukwGmX0uNZubsunL0qcANuTYkpapRVdlu5q3ymCpvOEh.
|
||||
|
||||
# this file should always end with an empty line!
|
||||
89
deploy/all-in-one/README.md
Normal file
89
deploy/all-in-one/README.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# All-in-one deployment
|
||||
|
||||
The all in one deployment is recommended, if you want to host on a small machine
|
||||
with a low amount of players.
|
||||
|
||||
In this case, all kinds of OpenMU subsystems (ConnectServer, GameServer, LoginServer,
|
||||
AdminPanel, ...) are running in one process.
|
||||
|
||||
## Deployment with docker-compose
|
||||
|
||||
### Install GIT
|
||||
|
||||
See [https://github.com/git-guides/install-git](https://github.com/git-guides/install-git).
|
||||
|
||||
### Clone the repository
|
||||
|
||||
`git clone https://github.com/MUnique/OpenMU.git`
|
||||
|
||||
It will create a new folder OpenMU with the repository contents inside.
|
||||
|
||||
### Navigate to the docker-compose files
|
||||
|
||||
Navigate to the folder deploy/all-in-one
|
||||
|
||||
`cd deploy/all-in-one`
|
||||
|
||||
### Option A - for local testing
|
||||
|
||||
To use the official docker image, just run:
|
||||
|
||||
`docker compose up -d --no-build`
|
||||
|
||||
And that's it. It's then available on your local computer through a loopback ip.
|
||||
|
||||
However, if you want to make it available through the internet, you should choose
|
||||
Option B:
|
||||
|
||||
### Option B - with HTTPS
|
||||
|
||||
If you want to share your server with the world, it's recommended to set up HTTPS
|
||||
for nginx. Otherwise, traffic from and to the admin panel is not encrypted.
|
||||
|
||||
#### Set your domain name as environment variable
|
||||
|
||||
Specify the environment variable ```DOMAIN_NAME``` for docker compose.
|
||||
This can be done in [various ways](https://docs.docker.com/compose/environment-variables/set-environment-variables/),
|
||||
e.g. by editing the ```docker-compose.prod.yml``` or
|
||||
[setting it in your shell](https://phoenixnap.com/kb/linux-set-environment-variable).
|
||||
|
||||
This variable is replaced in the nginx template config files which get included
|
||||
in the other configuration files.
|
||||
|
||||
#### Run it
|
||||
|
||||
`docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d`
|
||||
|
||||
#### Run certbot explicitly
|
||||
|
||||
Hint: replace "example.org" with your domain.
|
||||
|
||||
`docker compose -f docker-compose.yml -f docker-compose.prod.yml run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d example.org`
|
||||
|
||||
#### Set up certificate renewal
|
||||
|
||||
Because your certificates expire after 3 months, it's recommended to renew them regularly.
|
||||
To renew it, run this command:
|
||||
|
||||
`docker compose -f docker-compose.yml -f docker-compose.prod.yml run --rm certbot renew`
|
||||
|
||||
Of course, it would make sense to add a cron job (e.g. once a week) on your host
|
||||
machine for that.
|
||||
|
||||
## What's next
|
||||
|
||||
The server is automatically started and initialized for Season 6. You can start
|
||||
playing, if you want :-)
|
||||
|
||||
Additionally, take a look at the AdminPanel.
|
||||
|
||||
If your containers run on docker at your local machine, you can simply go to `http://localhost/`.
|
||||
The default username is 'admin', the password 'openmu'. You should change that later.
|
||||
|
||||
If you want to run another game version, you can go to the setup page through
|
||||
the navigation menu, where you can select your desired game version,
|
||||
number of game servers (just the data of it), and if test accounts
|
||||
should be created.
|
||||
|
||||
If you click on 'Install', wait a bit until the database is set up and filled with the
|
||||
data and voila, OpenMU is ready to use.
|
||||
30
deploy/all-in-one/docker-compose-all-in-one.dcproj
Normal file
30
deploy/all-in-one/docker-compose-all-in-one.dcproj
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectGuid>6518d58a-5f07-4341-87af-fcf3715d2554</ProjectGuid>
|
||||
<DockerLaunchAction>None</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DockerServiceName>openmu-startup</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="docker-compose.override.yml">
|
||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||
</None>
|
||||
<None Include="docker-compose.prod.yml">
|
||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||
</None>
|
||||
<None Include="docker-compose.yml" />
|
||||
<None Include=".dockerignore" />
|
||||
<None Include=".htpasswd" />
|
||||
<None Include="nginx\nginx.dev.conf" />
|
||||
<None Include="nginx\nginx.prod443.conf" />
|
||||
<None Include="nginx\nginx.prod80.conf" />
|
||||
<None Include="nginx\templates\nginx.prod.certificates.conf.template" />
|
||||
<None Include="nginx\templates\nginx.server_name.conf.template" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
13
deploy/all-in-one/docker-compose.override.yml
Normal file
13
deploy/all-in-one/docker-compose.override.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
|
||||
openmu-startup:
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Startup/Dockerfile
|
||||
restart: "no"
|
||||
ports:
|
||||
- "8081:8080"
|
||||
|
||||
database:
|
||||
ports:
|
||||
- "5433:5432"
|
||||
46
deploy/all-in-one/docker-compose.prod.yml
Normal file
46
deploy/all-in-one/docker-compose.prod.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
services:
|
||||
openmu-startup:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
database:
|
||||
restart: "unless-stopped"
|
||||
|
||||
nginx-80:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||
volumes:
|
||||
- ./nginx/nginx.prod80.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
- ./certbot/www:/var/www/certbot/:ro
|
||||
- ./nginx/templates/nginx.server_name.conf.template:/etc/nginx/templates/nginx.server_name.conf.template:ro
|
||||
|
||||
# We add another nginx here, just for HTTPs.
|
||||
# The reason is, that it's not starting when we combine port 80 and 443 until
|
||||
# the certificates are created.
|
||||
# So, when running the certbot the first time, we need to be able to access
|
||||
# the port 80 - and we solve this by separating the server configs.
|
||||
nginx-443:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-443
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||
ports:
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./nginx/nginx.prod443.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
- ./certbot/conf/:/etc/nginx/ssl/:ro
|
||||
- ./nginx/templates/nginx.server_name.conf.template:/etc/nginx/templates/nginx.server_name.conf.template:ro
|
||||
- ./nginx/templates/nginx.prod.certificates.conf.template:/etc/nginx/templates/nginx.prod.certificates.conf.template:ro
|
||||
depends_on:
|
||||
- openmu-startup
|
||||
|
||||
certbot:
|
||||
image: certbot/certbot:latest
|
||||
volumes:
|
||||
- ./certbot/www/:/var/www/certbot/:rw
|
||||
- ./certbot/conf/:/etc/letsencrypt/:rw
|
||||
49
deploy/all-in-one/docker-compose.yml
Normal file
49
deploy/all-in-one/docker-compose.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
services:
|
||||
nginx-80:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-80
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx/nginx.dev.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
depends_on:
|
||||
- openmu-startup
|
||||
|
||||
openmu-startup:
|
||||
image: munique/openmu
|
||||
container_name: openmu-startup
|
||||
ports:
|
||||
- "8080"
|
||||
- "55901:55901"
|
||||
- "55902:55902"
|
||||
- "55903:55903"
|
||||
- "55904:55904"
|
||||
- "55905:55905"
|
||||
- "55906:55906"
|
||||
- "44405:44405"
|
||||
- "44406:44406"
|
||||
- "55980:55980"
|
||||
environment:
|
||||
DB_HOST: database
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
working_dir: /app/
|
||||
volumes:
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
depends_on:
|
||||
- database
|
||||
|
||||
database:
|
||||
image: postgres
|
||||
container_name: database
|
||||
environment:
|
||||
POSTGRES_PASSWORD: admin
|
||||
POSTGRES_DB: openmu
|
||||
POSTGRES_USER: postgres
|
||||
ports:
|
||||
- "5432"
|
||||
volumes:
|
||||
- dbdata:/var/lib/postgresql #store data on volume
|
||||
|
||||
volumes:
|
||||
dbdata:
|
||||
26
deploy/all-in-one/nginx/nginx.dev.conf
Normal file
26
deploy/all-in-one/nginx/nginx.dev.conf
Normal file
@@ -0,0 +1,26 @@
|
||||
events {
|
||||
}
|
||||
|
||||
http {
|
||||
# this is required to proxy Grafana Live WebSocket connections.
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
auth_basic "Protected Site";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
|
||||
listen 80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://openmu-startup:8080;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
deploy/all-in-one/nginx/nginx.prod443.conf
Normal file
32
deploy/all-in-one/nginx/nginx.prod443.conf
Normal file
@@ -0,0 +1,32 @@
|
||||
events {
|
||||
}
|
||||
|
||||
http {
|
||||
# this is required to proxy Grafana Live WebSocket connections.
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 default_server ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
include conf.d/nginx.server_name.conf;
|
||||
include conf.d/nginx.prod.certificates.conf;
|
||||
|
||||
auth_basic "Protected Site";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
|
||||
listen 80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://openmu-startup:8080;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
deploy/all-in-one/nginx/nginx.prod80.conf
Normal file
20
deploy/all-in-one/nginx/nginx.prod80.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
events {
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
include conf.d/nginx.server_name.conf;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
ssl_certificate /etc/nginx/ssl/live/$DOMAIN_NAME/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/live/$DOMAIN_NAME/privkey.pem;
|
||||
@@ -0,0 +1 @@
|
||||
server_name $DOMAIN_NAME;
|
||||
25
deploy/distributed/.dockerignore
Normal file
25
deploy/distributed/.dockerignore
Normal file
@@ -0,0 +1,25 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
7
deploy/distributed/.htpasswd
Normal file
7
deploy/distributed/.htpasswd
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file contains the passwords for the admin panel and tracing.
|
||||
# Change these passwords in production!
|
||||
# default is admin:openmu, hashed with bcrypt.
|
||||
|
||||
admin:$2y$10$xYL2d/QEukwGmX0uNZubsunL0qcANuTYkpapRVdlu5q3ymCpvOEh.
|
||||
|
||||
# this file should always end with an empty line!
|
||||
121
deploy/distributed/README.md
Normal file
121
deploy/distributed/README.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# Distributed
|
||||
|
||||
*!!! CURRENTLY BROKEN AND UNSUPPORTED, DOCS ARE OUT OF DATE !!!*
|
||||
|
||||
## Deployment with docker-compose
|
||||
|
||||
Currently, we just have a docker-compose file for the deployment.
|
||||
docker-compose has the limitation, that all runs on the same physical machine.
|
||||
|
||||
For an even more distributed environment, with more machines, kubernetes can be
|
||||
used. However, we don't have a finished configuration for kubernetes, yet. If you
|
||||
are familiar with kubernetes, all contributions are welcome for kubernetes
|
||||
configuration files.
|
||||
|
||||
So, these are the steps, if you want to deploy it with docker-compose:
|
||||
|
||||
### Install GIT
|
||||
|
||||
See [https://github.com/git-guides/install-git](https://github.com/git-guides/install-git).
|
||||
|
||||
### Clone the repository
|
||||
|
||||
`git clone https://github.com/MUnique/OpenMU.git`
|
||||
|
||||
It will create a new folder OpenMU with the repository contents inside.
|
||||
|
||||
### Navigate to the docker-compose files
|
||||
|
||||
Navigate to the folder deploy/distributed
|
||||
|
||||
`cd deploy/distributed`
|
||||
|
||||
### Option A - for local testing
|
||||
|
||||
To use the official docker images, just run:
|
||||
|
||||
`docker compose up -d --no-build`
|
||||
|
||||
And that's it. It's then available on your local computer through a loopback ip.
|
||||
|
||||
However, if you want to make it available through the internet, you should choose
|
||||
Option B:
|
||||
|
||||
### Option B - with HTTPS
|
||||
|
||||
If you want to share your server with the world, it's recommended to set up HTTPS
|
||||
for nginx. Otherwise, traffic from and to the admin panel is not encrypted.
|
||||
|
||||
#### Set your domain name as environment variable
|
||||
|
||||
Specify the environment variable ```DOMAIN_NAME``` for docker compose.
|
||||
This can be done in [various ways](https://docs.docker.com/compose/environment-variables/set-environment-variables/),
|
||||
e.g. by editing the ```docker-compose.prod.yml``` or
|
||||
[setting it in your shell](https://phoenixnap.com/kb/linux-set-environment-variable).
|
||||
|
||||
This variable is replaced in the nginx template config files which get included
|
||||
in the other configuration files.
|
||||
|
||||
#### Run it
|
||||
|
||||
`docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d`
|
||||
|
||||
#### Run certbot explicitly
|
||||
|
||||
Hint: replace "example.org" with your domain.
|
||||
|
||||
`docker compose -f docker-compose.yml -f docker-compose.prod.yml run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d example.org`
|
||||
|
||||
#### Set up certificate renewal
|
||||
|
||||
Because your certificates expire after 3 months, it's recommended to renew them regularly.
|
||||
To renew it, run this command:
|
||||
|
||||
`docker compose -f docker-compose.yml -f docker-compose.prod.yml run --rm certbot renew`
|
||||
|
||||
Of course, it would make sense to add a cron job (e.g. once a week) on your host
|
||||
machine for that.
|
||||
|
||||
## What's next
|
||||
|
||||
Now, when you have deployed OpenMU, it's time to discover the AdminPanel.
|
||||
|
||||
If your containers run on docker at your local machine, you can simply go to `http://localhost/admin`.
|
||||
The default username is 'admin', the password 'openmu'. You should change that later.
|
||||
|
||||
There you'll find a setup in the navigation menu, where you can select your desired
|
||||
game version, number of game servers (just the data of it), and if test accounts
|
||||
should be created.
|
||||
|
||||
Click on 'Install', wait a bit until the database is set up and filled with the
|
||||
data.
|
||||
OpenMU should now be ready to use.
|
||||
|
||||
## Environment variables
|
||||
|
||||
The openmu images which are used in this docker-compose consider the following
|
||||
environment variables:
|
||||
|
||||
### ASPNETCORE_ENVIRONMENT
|
||||
|
||||
It's usually specified correctly in the docker-compose files. It has effect on
|
||||
the ip resolver, see below.
|
||||
|
||||
### RESOLVE_IP
|
||||
|
||||
Similar to the -resolveIp starting parameter of the all-in-one startup project,
|
||||
you're able to control the ip resolving with this variable. The defaults usually
|
||||
work fine here, so you should try not to set this variable.
|
||||
|
||||
| Value | Description |
|
||||
|-------|---------------------|
|
||||
| local | Default value in a *Development* environment. Determines a local ip. If none is found, a loopback IP is used (127.127.127.127). |
|
||||
| public | Default value in a *Production* environment. The public ip is automatically determined by an [external API](https://www.ipify.org/). |
|
||||
| loopback | Returns *127.127.127.127*, usefully only if you run your server and client on the same machine. |
|
||||
| [custom ip] | You can specify a custom ip, if needed. Example: *192.168.0.1* |
|
||||
|
||||
### GS_ID
|
||||
|
||||
It's usually specified correctly in the docker-compose files or each game server.
|
||||
Specifies the id of a game server, and is used to retrieve the GameServerConfiguration
|
||||
from the database.
|
||||
11
deploy/distributed/dapr-components/config.yaml
Normal file
11
deploy/distributed/dapr-components/config.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Configuration
|
||||
metadata:
|
||||
name: daprConfig
|
||||
namespace: default
|
||||
spec:
|
||||
tracing:
|
||||
enabled: true
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://zipkin:9411/api/v2/spans"
|
||||
13
deploy/distributed/dapr-components/localSecretStore.yaml
Normal file
13
deploy/distributed/dapr-components/localSecretStore.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: secrets
|
||||
namespace: default
|
||||
spec:
|
||||
type: secretstores.local.file
|
||||
version: v1
|
||||
metadata:
|
||||
- name: secretsFile
|
||||
value: components/secrets.json
|
||||
- name: nestedSeparator
|
||||
value: ":"
|
||||
13
deploy/distributed/dapr-components/login-state.yaml
Normal file
13
deploy/distributed/dapr-components/login-state.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: login-state
|
||||
spec:
|
||||
spec:
|
||||
type: state.redis
|
||||
version: v1
|
||||
metadata:
|
||||
- name: redisHost
|
||||
value: redis-state:6379
|
||||
#- name: ttlInSeconds
|
||||
# value: <int> # Optional
|
||||
20
deploy/distributed/dapr-components/pubsub.yaml
Normal file
20
deploy/distributed/dapr-components/pubsub.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: pubsub
|
||||
spec:
|
||||
type: pubsub.rabbitmq
|
||||
version: v1
|
||||
metadata:
|
||||
- name: host
|
||||
value: "amqp://rabbit:5672"
|
||||
- name: durable
|
||||
value: "true"
|
||||
- name: deletedWhenUnused
|
||||
value: "false"
|
||||
- name: autoAck
|
||||
value: "false"
|
||||
- name: reconnectWait
|
||||
value: "0"
|
||||
- name: concurrency
|
||||
value: parallel
|
||||
11
deploy/distributed/dapr-components/secrets.json
Normal file
11
deploy/distributed/dapr-components/secrets.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"connectionStrings": {
|
||||
"MUnique.OpenMU.Persistence.EntityFramework.EntityDataContext": "Server=database;Port=5432;User Id=postgres;Password=admin;Database=openmu;Command Timeout=120;",
|
||||
"MUnique.OpenMU.Persistence.EntityFramework.TypedContext": "Server=database;Port=5432;User Id=postgres;Password=admin;Database=openmu;Command Timeout=120;",
|
||||
"MUnique.OpenMU.Persistence.EntityFramework.ConfigurationContext": "Server=database;Port=5432;User Id=config;Password=config;Database=openmu;Command Timeout=120;",
|
||||
"MUnique.OpenMU.Persistence.EntityFramework.AccountContext": "Server=database;Port=5432;User Id=account;Password=account;Database=openmu;Command Timeout=120;",
|
||||
"MUnique.OpenMU.Persistence.EntityFramework.TradeContext": "Server=database;Port=5432;User Id=account;Password=account;Database=openmu;Command Timeout=120;",
|
||||
"MUnique.OpenMU.Persistence.EntityFramework.FriendContext": "Server=database;Port=5432;User Id=friend;Password=friend;Database=openmu;Command Timeout=120;",
|
||||
"MUnique.OpenMU.Persistence.EntityFramework.GuildContext": "Server=database;Port=5432;User Id=guild;Password=guild;Database=openmu;Command Timeout=120;"
|
||||
}
|
||||
}
|
||||
39
deploy/distributed/docker-compose.dcproj
Normal file
39
deploy/distributed/docker-compose.dcproj
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectGuid>0dfecd55-7aa2-4263-b6fd-ec1c4e6a59b3</ProjectGuid>
|
||||
<DockerLaunchAction>None</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DockerServiceName>openmu-distributed</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="dapr-components\config.yaml" />
|
||||
<None Include="dapr-components\localSecretStore.yaml" />
|
||||
<None Include="dapr-components\login-state.yaml" />
|
||||
<None Include="dapr-components\pubsub.yaml" />
|
||||
<None Include="dapr-components\secrets.json" />
|
||||
<None Include="docker-compose.override.yml">
|
||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||
</None>
|
||||
<None Include="docker-compose.prod.yml">
|
||||
<DependentUpon>docker-compose.yml</DependentUpon>
|
||||
</None>
|
||||
<None Include="docker-compose.yml" />
|
||||
<None Include=".dockerignore" />
|
||||
<None Include=".htpasswd" />
|
||||
<None Include="grafana.ini" />
|
||||
<None Include="grafana_datasources.yaml" />
|
||||
<None Include="loki-config.yaml" />
|
||||
<None Include="nginx.prod.certificates.conf.template" />
|
||||
<None Include="nginx.server_name.conf.template" />
|
||||
<None Include="nginx.prod80.conf" />
|
||||
<None Include="nginx.prod443.conf" />
|
||||
<None Include="nginx.dev.conf" />
|
||||
<None Include="prometheus.yml" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
70
deploy/distributed/docker-compose.override.yml
Normal file
70
deploy/distributed/docker-compose.override.yml
Normal file
@@ -0,0 +1,70 @@
|
||||
services:
|
||||
database:
|
||||
ports:
|
||||
- "5433:5432"
|
||||
loki:
|
||||
ports:
|
||||
- "3100:3100"
|
||||
prometheus:
|
||||
ports:
|
||||
- "9000:9090"
|
||||
|
||||
redis-state:
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
gameServer0:
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
ports:
|
||||
- "81:8080"
|
||||
|
||||
gameServer1:
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
ports:
|
||||
- "82:8080"
|
||||
|
||||
connectServer:
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/ConnectServer.Host/Dockerfile
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
|
||||
loginServer:
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/LoginServer.Host/Dockerfile
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
|
||||
friendServer:
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/FriendServer.Host/Dockerfile
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
|
||||
guildServer:
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/GuildServer.Host/Dockerfile
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
|
||||
chatServer:
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/ChatServer.Host/Dockerfile
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
|
||||
adminPanel:
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/AdminPanel.Host/Dockerfile
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
ports:
|
||||
- "88:8080"
|
||||
103
deploy/distributed/docker-compose.prod.yml
Normal file
103
deploy/distributed/docker-compose.prod.yml
Normal file
@@ -0,0 +1,103 @@
|
||||
volumes:
|
||||
certificates:
|
||||
certbot-www:
|
||||
|
||||
services:
|
||||
nginx-80:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||
volumes:
|
||||
- ./nginx.server_name.conf.template:/etc/nginx/templates/nginx.server_name.conf.template
|
||||
- ./nginx.prod80.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
- certbot-www:/var/www/certbot/:ro
|
||||
|
||||
# We add another nginx here, just for HTTPs.
|
||||
# The reason is, that it's not starting when we combine port 80 and 443 until
|
||||
# the certificates are created.
|
||||
# So, when running the certbot the first time, we need to be able to access
|
||||
# the port 80 - and we solve this by separating the server configs.
|
||||
nginx-443:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-443
|
||||
restart: "unless-stopped"
|
||||
ports:
|
||||
- "443:443"
|
||||
environment:
|
||||
DOMAIN_NAME: ${DOMAIN_NAME}
|
||||
volumes:
|
||||
- ./nginx.server_name.conf.template:/etc/nginx/templates/nginx.server_name.conf.template
|
||||
- ./nginx.prod.certificates.conf.template:/etc/nginx/templates/nginx.prod.certificates.conf.template
|
||||
- ./nginx.prod443.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
- certificates:/etc/nginx/ssl/:ro
|
||||
depends_on:
|
||||
- grafana
|
||||
- zipkin
|
||||
- prometheus
|
||||
|
||||
certbot:
|
||||
image: certbot/certbot:latest
|
||||
volumes:
|
||||
- certbot-www:/var/www/certbot/:rw
|
||||
- certificates:/etc/letsencrypt/:rw
|
||||
|
||||
grafana:
|
||||
restart: "unless-stopped"
|
||||
prometheus:
|
||||
restart: "unless-stopped"
|
||||
loki:
|
||||
restart: "unless-stopped"
|
||||
minio:
|
||||
restart: "unless-stopped"
|
||||
redis-state:
|
||||
restart: "unless-stopped"
|
||||
dapr-placement:
|
||||
restart: "unless-stopped"
|
||||
rabbit:
|
||||
restart: "unless-stopped"
|
||||
database:
|
||||
restart: "unless-stopped"
|
||||
zipkin:
|
||||
restart: "unless-stopped"
|
||||
|
||||
connectServer:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
loginServer:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
friendServer:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
guildServer:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
chatServer:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
adminPanel:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
gameServer0:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
|
||||
gameServer1:
|
||||
restart: "unless-stopped"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
352
deploy/distributed/docker-compose.yml
Normal file
352
deploy/distributed/docker-compose.yml
Normal file
@@ -0,0 +1,352 @@
|
||||
volumes:
|
||||
dbdata:
|
||||
prometheus-data:
|
||||
minio-data:
|
||||
|
||||
services:
|
||||
nginx-80:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-80
|
||||
restart: always
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.dev.conf:/etc/nginx/nginx.conf
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
depends_on:
|
||||
- grafana
|
||||
- zipkin
|
||||
- prometheus
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:9.5.14
|
||||
container_name: grafana
|
||||
volumes:
|
||||
- ./grafana.ini:/etc/grafana/grafana.ini
|
||||
- ./grafana_datasources.yaml:/etc/grafana/provisioning/datasources/ds.yaml
|
||||
depends_on:
|
||||
- loki
|
||||
- prometheus
|
||||
ports:
|
||||
- 3000
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.21.0
|
||||
ports:
|
||||
- 9090
|
||||
volumes:
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- prometheus-data:/prometheus
|
||||
command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
|
||||
|
||||
loki:
|
||||
image: grafana/loki:2.5.0
|
||||
container_name: loki
|
||||
command: "-config.file=/etc/loki/config.yaml -target=all"
|
||||
ports:
|
||||
- 3100
|
||||
- 7946
|
||||
- 9095
|
||||
volumes:
|
||||
- ./loki-config.yaml:/etc/loki/config.yaml
|
||||
depends_on:
|
||||
- minio
|
||||
|
||||
minio:
|
||||
image: minio/minio
|
||||
entrypoint:
|
||||
- sh
|
||||
- -euc
|
||||
- |
|
||||
mkdir -p /data/loki-data && \
|
||||
mkdir -p /data/loki-ruler && \
|
||||
minio server /data
|
||||
environment:
|
||||
- MINIO_ACCESS_KEY=loki
|
||||
- MINIO_SECRET_KEY=supersecret
|
||||
- MINIO_PROMETHEUS_AUTH_TYPE=public
|
||||
- MINIO_UPDATE=off
|
||||
ports:
|
||||
- 9000
|
||||
volumes:
|
||||
- minio-data:/data
|
||||
|
||||
redis-state:
|
||||
image: redis
|
||||
restart: always
|
||||
ports:
|
||||
- 6379
|
||||
environment:
|
||||
ALLOW_EMPTY_PASSWORD: "yes"
|
||||
|
||||
dapr-placement:
|
||||
image: "daprio/dapr"
|
||||
container_name: dapr_placement
|
||||
command: ["./placement", "-port", "50006"]
|
||||
ports:
|
||||
- "50006"
|
||||
|
||||
rabbit:
|
||||
image: rabbitmq:3-management-alpine
|
||||
container_name: pubsub_rabbitmq
|
||||
restart: always
|
||||
ports:
|
||||
- "5672"
|
||||
|
||||
database:
|
||||
image: postgres
|
||||
container_name: postgres
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_PASSWORD: admin
|
||||
POSTGRES_DB: openmu
|
||||
POSTGRES_USER: postgres
|
||||
ports:
|
||||
- "5432"
|
||||
volumes:
|
||||
- dbdata:/var/lib/postgresql
|
||||
|
||||
zipkin:
|
||||
image: openzipkin/zipkin
|
||||
container_name: tracing_zipkin
|
||||
restart: always
|
||||
ports:
|
||||
- "9411:9411"
|
||||
|
||||
connectServer:
|
||||
image: munique/openmu-connect
|
||||
container_name: connectServer
|
||||
ports:
|
||||
- "50001"
|
||||
- "44405:44405"
|
||||
- "9464" # Prometheus
|
||||
environment:
|
||||
APPID: connectServer
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
depends_on:
|
||||
- rabbit
|
||||
- zipkin
|
||||
- database
|
||||
|
||||
connectServer-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: connectServer_dapr
|
||||
command: [ "./daprd", "-app-id", "connectServer", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
depends_on:
|
||||
- connectServer
|
||||
network_mode: "service:connectServer"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
|
||||
loginServer:
|
||||
image: munique/openmu-login
|
||||
container_name: loginServer
|
||||
ports:
|
||||
- "50001"
|
||||
- "9464" # Prometheus
|
||||
environment:
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
depends_on:
|
||||
- zipkin
|
||||
- database
|
||||
|
||||
loginServer-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: loginServer_dapr
|
||||
command: [ "./daprd", "-app-id", "loginServer", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
depends_on:
|
||||
- loginServer
|
||||
network_mode: "service:loginServer"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
|
||||
friendServer:
|
||||
image: munique/openmu-friend
|
||||
container_name: friendServer
|
||||
ports:
|
||||
- "50001"
|
||||
- "9464" # Prometheus
|
||||
environment:
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
depends_on:
|
||||
- chatServer-dapr
|
||||
- database
|
||||
- zipkin
|
||||
|
||||
friendServer-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: friendServer_dapr
|
||||
command: [ "./daprd", "-app-id", "friendServer", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
depends_on:
|
||||
- friendServer
|
||||
network_mode: "service:friendServer"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
|
||||
guildServer:
|
||||
image: munique/openmu-guild
|
||||
container_name: guildServer
|
||||
ports:
|
||||
- "50001"
|
||||
- "9464" # Prometheus
|
||||
environment:
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
depends_on:
|
||||
- database
|
||||
- zipkin
|
||||
|
||||
guildServer-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: guildServer_dapr
|
||||
command: [ "./daprd", "-app-id", "guildServer", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
depends_on:
|
||||
- guildServer
|
||||
network_mode: "service:guildServer"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
|
||||
chatServer:
|
||||
image: munique/openmu-chat
|
||||
container_name: chatServer
|
||||
environment:
|
||||
APPID: chatServer
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
ports:
|
||||
- "55980:55980"
|
||||
- "50001"
|
||||
- "9464" # Prometheus
|
||||
depends_on:
|
||||
- database
|
||||
- zipkin
|
||||
|
||||
chatServer-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: chatServer_dapr
|
||||
command: [ "./daprd", "-app-id", "chatServer", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
depends_on:
|
||||
- chatServer
|
||||
network_mode: "service:chatServer"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
|
||||
|
||||
adminPanel:
|
||||
image: munique/openmu-admin
|
||||
container_name: adminPanel
|
||||
depends_on:
|
||||
- database
|
||||
ports:
|
||||
- "8080"
|
||||
- "9464" # Prometheus
|
||||
environment:
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
PATH_BASE: /admin/
|
||||
volumes:
|
||||
- ./.htpasswd:/etc/nginx/.htpasswd
|
||||
|
||||
adminPanel-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: adminPanel_dapr
|
||||
command: [ "./daprd", "-app-id", "adminPanel", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
|
||||
depends_on:
|
||||
- adminPanel
|
||||
network_mode: "service:adminPanel"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
|
||||
gameServer0:
|
||||
image: munique/openmu-game
|
||||
container_name: gameServer0
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/GameServer.Host/Dockerfile
|
||||
ports:
|
||||
- "8080"
|
||||
- "50001"
|
||||
- "55901:55901"
|
||||
- "55902:55902"
|
||||
- "9464" # Prometheus
|
||||
environment:
|
||||
GS_ID: 0
|
||||
APPID: gameServer0
|
||||
PATH_BASE: /gameServer/0/
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
depends_on:
|
||||
- connectServer-dapr
|
||||
- loginServer-dapr
|
||||
- friendServer-dapr
|
||||
- rabbit
|
||||
- zipkin
|
||||
- database
|
||||
- loki
|
||||
|
||||
gameServer0-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: gameserver0_dapr
|
||||
command: [ "./daprd", "-app-id", "gameServer0", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
depends_on:
|
||||
- gameServer0
|
||||
network_mode: "service:gameServer0"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
|
||||
gameServer1:
|
||||
image: munique/openmu-game
|
||||
container_name: gameServer1
|
||||
build:
|
||||
context: ../../src
|
||||
dockerfile: Dapr/GameServer.Host/Dockerfile
|
||||
ports:
|
||||
- "8080"
|
||||
- "50001"
|
||||
- "55903:55903"
|
||||
- "55904:55904"
|
||||
- "9464" # Prometheus
|
||||
environment:
|
||||
GS_ID: 1
|
||||
APPID: gameServer1
|
||||
PATH_BASE: /gameServer/1/
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
depends_on:
|
||||
- connectServer-dapr
|
||||
- loginServer-dapr
|
||||
- friendServer-dapr
|
||||
- rabbit
|
||||
- zipkin
|
||||
- database
|
||||
- loki
|
||||
|
||||
gameServer1-dapr:
|
||||
image: "daprio/daprd:latest"
|
||||
container_name: gameserver1_dapr
|
||||
command: [ "./daprd", "-app-id", "gameServer1", "-app-port", "8080",
|
||||
"-components-path", "/components",
|
||||
"-config", "/components/config.yaml",
|
||||
"-placement-host-address", "dapr-placement:50006" ]
|
||||
depends_on:
|
||||
- gameServer1
|
||||
network_mode: "service:gameServer1"
|
||||
volumes:
|
||||
- "./dapr-components/:/components"
|
||||
1157
deploy/distributed/grafana.ini
Normal file
1157
deploy/distributed/grafana.ini
Normal file
File diff suppressed because it is too large
Load Diff
10
deploy/distributed/grafana_datasources.yaml
Normal file
10
deploy/distributed/grafana_datasources.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: http://loki:3100
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
36
deploy/distributed/launchSettings.json
Normal file
36
deploy/distributed/launchSettings.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Docker Compose": {
|
||||
"commandName": "DockerCompose",
|
||||
"commandVersion": "1.0",
|
||||
"serviceActions": {
|
||||
"connectServer": "StartDebugging",
|
||||
"connectServer-dapr": "StartWithoutDebugging",
|
||||
"dapr-placement": "StartWithoutDebugging",
|
||||
"database": "StartWithoutDebugging",
|
||||
"gameServer1": "StartDebugging",
|
||||
"gameServer1-dapr": "StartWithoutDebugging",
|
||||
"rabbit": "StartWithoutDebugging",
|
||||
"friendServer": "StartDebugging",
|
||||
"friendServer-dapr": "StartWithoutDebugging",
|
||||
"loginServer": "StartDebugging",
|
||||
"loginServer-dapr": "StartWithoutDebugging",
|
||||
"guildServer": "StartDebugging",
|
||||
"guildServer-dapr": "StartWithoutDebugging",
|
||||
"chatServer": "StartDebugging",
|
||||
"chatServer-dapr": "StartWithoutDebugging",
|
||||
"adminPanel": "StartDebugging",
|
||||
"adminPanel-dapr": "StartWithoutDebugging",
|
||||
"grafana": "StartWithoutDebugging",
|
||||
"loki": "StartWithoutDebugging",
|
||||
"minio": "StartWithoutDebugging",
|
||||
"nginx-80": "StartWithoutDebugging",
|
||||
"prometheus": "StartWithoutDebugging",
|
||||
"zipkin": "StartWithoutDebugging",
|
||||
"gameServer0": "StartWithoutDebugging",
|
||||
"gameServer0-dapr": "StartWithoutDebugging",
|
||||
"redis-state": "StartWithoutDebugging"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
deploy/distributed/loki-config.yaml
Normal file
36
deploy/distributed/loki-config.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
auth_enabled: false
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
memberlist:
|
||||
join_members:
|
||||
- loki:7946
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2021-08-01
|
||||
store: boltdb-shipper
|
||||
object_store: s3
|
||||
schema: v11
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
#limits_config:
|
||||
# max_streams_per_user: 100000
|
||||
common:
|
||||
path_prefix: /loki
|
||||
replication_factor: 1
|
||||
storage:
|
||||
s3:
|
||||
endpoint: minio:9000
|
||||
insecure: true
|
||||
bucketnames: loki-data
|
||||
access_key_id: loki
|
||||
secret_access_key: supersecret
|
||||
s3forcepathstyle: true
|
||||
ring:
|
||||
kvstore:
|
||||
store: memberlist
|
||||
ruler:
|
||||
storage:
|
||||
s3:
|
||||
bucketnames: loki-ruler
|
||||
65
deploy/distributed/nginx.dev.conf
Normal file
65
deploy/distributed/nginx.dev.conf
Normal file
@@ -0,0 +1,65 @@
|
||||
events {
|
||||
}
|
||||
|
||||
http {
|
||||
# this is required to proxy Grafana Live WebSocket connections.
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
auth_basic "Protected Site";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
|
||||
listen 80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
|
||||
location /zipkin {
|
||||
proxy_pass http://zipkin:9411/zipkin/;
|
||||
}
|
||||
|
||||
location /grafana/ {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_pass http://grafana:3000/;
|
||||
|
||||
# Auth by nginx
|
||||
proxy_set_header X-WEBAUTH-USER $remote_user;
|
||||
proxy_set_header Authorization "";
|
||||
}
|
||||
|
||||
# Proxy Grafana Live WebSocket connections.
|
||||
location /grafana/api/live {
|
||||
rewrite ^/grafana/(.*) /$1 break;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_pass http://grafana:3000/;
|
||||
|
||||
# Auth by nginx
|
||||
proxy_set_header X-WEBAUTH-USER $remote_user;
|
||||
proxy_set_header Authorization "";
|
||||
}
|
||||
|
||||
location ~ (/admin)(.*) {
|
||||
proxy_pass http://adminPanel:8080/admin$2;
|
||||
}
|
||||
|
||||
# Public API
|
||||
location ~ (/serverInfo)(.*) {
|
||||
proxy_pass http://connectServer:8080/serverInfo$2;
|
||||
auth_basic off;
|
||||
}
|
||||
|
||||
# Game Servers:
|
||||
location ~ (/gameServer/(\d+)(.*)) {
|
||||
proxy_pass http://gameServer$2:8080$1;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
deploy/distributed/nginx.prod.certificates.conf.template
Normal file
2
deploy/distributed/nginx.prod.certificates.conf.template
Normal file
@@ -0,0 +1,2 @@
|
||||
ssl_certificate /etc/nginx/ssl/live/$DOMAIN_NAME/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/live/$DOMAIN_NAME/privkey.pem;
|
||||
70
deploy/distributed/nginx.prod443.conf
Normal file
70
deploy/distributed/nginx.prod443.conf
Normal file
@@ -0,0 +1,70 @@
|
||||
events {
|
||||
}
|
||||
|
||||
http {
|
||||
# this is required to proxy Grafana Live WebSocket connections.
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 default_server ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
include conf.d/nginx.server_name.conf;
|
||||
include conf.d/nginx.prod.certificates.conf;
|
||||
|
||||
auth_basic "Protected Site";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
|
||||
location /zipkin {
|
||||
proxy_pass http://zipkin:9411/zipkin/;
|
||||
}
|
||||
|
||||
location /grafana/ {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_pass http://grafana:3000/;
|
||||
|
||||
# Auth by nginx
|
||||
proxy_set_header X-WEBAUTH-USER $remote_user;
|
||||
proxy_set_header Authorization "";
|
||||
}
|
||||
|
||||
# Proxy Grafana Live WebSocket connections.
|
||||
location /grafana/api/live {
|
||||
rewrite ^/grafana/(.*) /$1 break;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_pass http://grafana:3000/;
|
||||
|
||||
# Auth by nginx
|
||||
proxy_set_header X-WEBAUTH-USER $remote_user;
|
||||
proxy_set_header Authorization "";
|
||||
}
|
||||
|
||||
location ~ (/admin)(.*) {
|
||||
proxy_pass http://adminPanel:8080/admin$2;
|
||||
}
|
||||
|
||||
# Public API
|
||||
location ~ (/serverInfo)(.*) {
|
||||
proxy_pass http://connectServer:8080/serverInfo$2;
|
||||
auth_basic off;
|
||||
}
|
||||
|
||||
# Game Servers:
|
||||
location ~ (/gameServer/(\d+)(.*)) {
|
||||
proxy_pass http://gameServer$2:8080$1;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
deploy/distributed/nginx.prod80.conf
Normal file
20
deploy/distributed/nginx.prod80.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
events {
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
include conf.d/nginx.server_name.conf;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
deploy/distributed/nginx.server_name.conf.template
Normal file
1
deploy/distributed/nginx.server_name.conf.template
Normal file
@@ -0,0 +1 @@
|
||||
server_name $DOMAIN_NAME;
|
||||
14
deploy/distributed/prometheus.yml
Normal file
14
deploy/distributed/prometheus.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
global:
|
||||
scrape_interval: 10s
|
||||
evaluation_interval: 10s
|
||||
|
||||
rule_files:
|
||||
|
||||
scrape_configs:
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
- job_name: openmu
|
||||
static_configs:
|
||||
- targets: ['gameServer1:9464', 'connectServer:9464', 'chatServer:9464']
|
||||
|
||||
Reference in New Issue
Block a user