-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose-build.yml
More file actions
141 lines (124 loc) · 4.54 KB
/
docker-compose-build.yml
File metadata and controls
141 lines (124 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Set the prefix for all containers/volumes. Otherwise the parent foldername will be used
name: reversim
# The volumes store all data that shall be persisted between container restarts or that
# have to be tweaked externally.
volumes:
# Location for the database, player event logging, screenshots etc.
# Set to external to make it harder to delete this volume by accident, however you will
# need to manually create the volume with the command:
# docker volume create reversim_playerdata
playerdata:
name: reversim_playerdata
#external: true
# If enabled in reversim_uwsgi.ini, uWSGI will log the server logs into text files
# instead of stdout. This way you do not loose the logs when you restart
# the Docker container
#uwsgi_logs:
metric_secret:
# All containers that belong to this compose file
services:
# the container will be named reversim_game when launched
game:
image: reversim
pull_policy: build
build: .
restart: unless-stopped
ports:
- "8000:8000" # outside:inside container
# mount your volumes here
volumes:
- playerdata:/usr/var/reversim-instance/statistics
- metric_secret:/usr/var/reversim-instance/secrets
#- uwsgi_logs:/var/log/uwsgi
# add resource limits. You may want to tweak this for your deployment
deploy:
resources:
# prevent malfunction of this container from affecting the host
limits:
# 4 threads may run simultaneously, the rest is queued
cpus: '4'
# the OOM killer will be invoked when this limit is hit (leads to container restart)
memory: 4G
# no fork bombs
pids: 24
# guarantee that this container will have sufficient resources regardless of
# what other containers on this host are doing
reservations:
# 2 cores are exclusively available for this container
cpus: '2'
# 250M are preallocated to this container
memory: 250M
restart_policy:
# restart if the container's entrypoint command exits with nonzero status code
condition: on-failure
# when the container crashes, wait 10s before attempting restart
delay: 10s
# after 3 unsuccessful restart attempts, assume the container is unable to start and give up
max_attempts: 3
develop:
watch:
- action: rebuild
path: app/
# WARNING: This is just a demo instance, no data is persisted as there is no volume mounted!
prometheus:
image: prom/prometheus
# Containers inside the compose can always access the metrics. You only need this line for access from the outside
#ports:
# - 9090:9090
configs:
# https://github.com/prometheus/prometheus/issues/3441
- source: prometheus.yml
target: /etc/prometheus/prometheus.yml
uid: "65534"
profiles:
- grafana
volumes:
- metric_secret:/etc/reversim/secrets:ro
#entrypoint: ["ls", "-lan", "/etc/prometheus"]
grafana:
image: grafana/grafana-oss
ports:
- 3000:3000
configs:
- source: grafana_datasources.yml
target: /etc/grafana/provisioning/datasources/automatic.yml
- source: grafana_dashboard.yml
target: /etc/grafana/provisioning/dashboards/reversim.yml
- source: grafana_dashboard_essentials
target: /var/lib/grafana/dashboards/grafana-dashboard.json
profiles:
- grafana
configs:
# NOTE: The prometheus and game hostname only works inside this compose stack
prometheus.yml:
content: |
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # Evaluate rules every 15 seconds.
scrape_configs:
- job_name: 'reversim'
static_configs:
- targets: ['game:8000']
bearer_token_file: '/etc/reversim/secrets/bearer_api.txt'
grafana_datasources.yml:
content: |
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus:9090
editable: true
grafana_dashboard_essentials:
file: examples/grafana-dashboard-provisioned.json
grafana_dashboard.yml:
content: |
apiVersion: 1
providers:
- name: 'ReverSim'
orgId: 1
type: file
disableDeletion: false
updateIntervalSeconds: 10
# Provisioned Dashboards will override your changes, therefore we disable it
allowUiUpdates: false
options:
path: /var/lib/grafana/dashboards/grafana-dashboard.json