-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add traefik loadbalancer to docker stack
- Loading branch information
1 parent
1cd7ffc
commit 2be809e
Showing
12 changed files
with
90 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ docker-compose.yml | |
.env.prod | ||
.lintr | ||
restart.txt | ||
inst/log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
.git | ||
*.log | ||
**/*.log | ||
renv/library | ||
renv/local | ||
renv/staging | ||
Dockerfile | ||
docker-compose.yml | ||
inst/log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
PROJECT_DIRECTORY=./inst/extdata/projects | ||
MEMORY_LIMIT=2G | ||
LOG_DIRECTORY=./inst/log | ||
LOG_LEVEL=ERROR | ||
MEMORY_LIMIT=4G | ||
REPLICAS=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
PROJECT_DIRECTORY=/opt/wheretowork/projects | ||
LOG_DIRECTORY=/opt/wheretowork/log | ||
LOG_LEVEL=ERROR | ||
MEMORY_LIMIT=10G | ||
REPLICAS=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ check.log | |
spell.log | ||
gp.log | ||
examples.log | ||
restart.txt | ||
inst/log/* | ||
|
||
# system files | ||
.directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,61 @@ | ||
version: "3.9" | ||
services: | ||
|
||
visualizer: | ||
image: dockersamples/visualizer:stable | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- "/var/run/docker.sock:/var/run/docker.sock" | ||
deploy: | ||
placement: | ||
constraints: [node.role == manager] | ||
|
||
watchtower: | ||
updater: | ||
image: v2tec/watchtower | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- /root/.docker/config.json:/config.json | ||
command: --schedule "0 0 * * *" --cleanup | ||
|
||
main: | ||
balancer: | ||
image: traefik:v1.7 | ||
command: --docker \ | ||
--docker.watch \ | ||
--docker.domain=localhost \ | ||
--web \ | ||
--loglevel=${LOG_LEVEL} | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
- "8080:8080" | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
deploy: | ||
mode: replicated | ||
replicas: 1 | ||
resources: | ||
limits: | ||
memory: 1G | ||
placement: | ||
constraints: [node.role == manager] | ||
networks: | ||
- net | ||
|
||
shiny: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: main | ||
image: naturecons/wheretowork:latest | ||
ports: | ||
- "3939:3838" | ||
volumes: | ||
- "${PROJECT_DIRECTORY}:/projects" | ||
- "${LOG_DIRECTORY}:/var/log/shiny-server/" | ||
deploy: | ||
mode: replicated | ||
replicas: "${REPLICAS}" | ||
restart_policy: | ||
condition: on-failure | ||
resources: | ||
limits: | ||
memory: "${MEMORY_LIMIT}" | ||
networks: | ||
- app | ||
- net | ||
labels: | ||
- "traefik.docker.network=ssp_net" | ||
- "traefik.port=3838" | ||
- "traefik.frontend.rule=PathPrefix:/;" | ||
- "traefik.backend.loadbalancer.sticky=true" | ||
|
||
networks: | ||
app: | ||
net: |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# define the user we should use when spawning R Shiny processes | ||
run_as shiny; | ||
|
||
# disable websocket | ||
disable_protocols websocket; | ||
|
||
# disable idle timeout to retain connection | ||
app_idle_timeout 0; | ||
|
||
# define a top-level server which will listen on a port | ||
server { | ||
# instruct this server to listen on port 3838 | ||
listen 3838; | ||
|
||
# define the location available at the base URL | ||
location / { | ||
|
||
# run this location in 'site_dir' mode, which hosts the entire directory | ||
# tree at '/srv/shiny-server' | ||
site_dir /srv/shiny-server; | ||
|
||
# define where we should put the log files for this location | ||
log_dir /var/log/shiny-server; | ||
|
||
# when a user visits the base URL rather than a particular application, | ||
# an index of the applications available in this directory will be shown. | ||
directory_index on; | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.