1
0
Fork 0
mirror of synced 2024-05-20 12:42:39 +12:00

Added loadbalancer

This commit is contained in:
Eldad Fux 2020-02-25 09:55:55 +02:00
parent 2b3b6a59fc
commit b326d2faee
6 changed files with 62 additions and 11 deletions

View file

@ -94,19 +94,19 @@ class CertificatesV1
throw new Exception('Failed to issue a certificate');
}
if(!@rename('/etc/letsencrypt/live/test.appwrite.org/cert.pem', APP_STORAGE_CERTIFICATES.'/cert.pem')) {
if(!@rename('/etc/letsencrypt/live/'.$domain->get().'/cert.pem', APP_STORAGE_CERTIFICATES.'/'.$domain->get().'/cert.pem')) {
throw new Exception('Failed to copy certificate cert.pem: '.json_encode($response));
}
if(!@rename('/etc/letsencrypt/live/test.appwrite.org/chain.pem', APP_STORAGE_CERTIFICATES.'/chain.pem')) {
if(!@rename('/etc/letsencrypt/live/'.$domain->get().'/chain.pem', APP_STORAGE_CERTIFICATES.'/'.$domain->get().'/chain.pem')) {
throw new Exception('Failed to copy certificate chain.pem: '.json_encode($response));
}
if(!@rename('/etc/letsencrypt/live/test.appwrite.org/fullchain.pem', APP_STORAGE_CERTIFICATES.'/fullchain.pem')) {
if(!@rename('/etc/letsencrypt/live/'.$domain->get().'/fullchain.pem', APP_STORAGE_CERTIFICATES.'/'.$domain->get().'/fullchain.pem')) {
throw new Exception('Failed to copy certificate fullchain.pem: '.json_encode($response));
}
if(!@rename('/etc/letsencrypt/live/test.appwrite.org/privkey.pem', APP_STORAGE_CERTIFICATES.'/privkey.pem')) {
if(!@rename('/etc/letsencrypt/live/'.$domain->get().'/privkey.pem', APP_STORAGE_CERTIFICATES.'/'.$domain->get().'/privkey.pem')) {
throw new Exception('Failed to copy certificate privkey.pem: '.json_encode($response));
}

View file

@ -1,6 +1,31 @@
version: '3'
services:
traefik:
image: traefik:v2.1.4
command:
- --log.level=DEBUG
- --api.insecure=true
- --providers.file.directory=/etc/traefik/dynamic_conf
- --providers.file.watch=true
- --providers.docker=true
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --accesslog=true
ports:
- 80:80
- 443:443
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.yml:/etc/traefik/dynamic_conf/conf.yml:ro
- ./docker/ssl/cert.pem:/certs/default.crt:ro
- ./docker/ssl/key.pem:/certs/default.key:ro
- appwrite-traefik:/traefik
networks:
- gateway
- appwrite
appwrite:
container_name: appwrite
build:
@ -10,7 +35,14 @@ services:
- VERSION=dev
restart: unless-stopped
networks:
- appwrite
- appwrite
labels:
- traefik.http.routers.appwrite.entrypoints=web
- traefik.http.routers.appwrite.rule=PathPrefix(`/`)
#- traefik.http.routers.appwrite.middlewares=demoHeader
- traefik.http.routers.appwrite-secure.entrypoints=websecure
- traefik.http.routers.appwrite-secure.rule=PathPrefix(`/`)
- traefik.http.routers.appwrite-secure.tls=true
volumes:
- appwrite-uploads:/storage/uploads:rw
- appwrite-cache:/storage/cache:rw
@ -23,9 +55,6 @@ services:
- ./public:/usr/share/nginx/html/public
- ./src:/usr/share/nginx/html/src
- ./docker/nginx.conf:/etc/nginx/nginx.conf
ports:
- "80:80"
- "443:443"
depends_on:
- mariadb
- redis
@ -128,6 +157,7 @@ services:
- appwrite
networks:
gateway:
appwrite:
volumes:
@ -136,3 +166,4 @@ volumes:
appwrite-uploads:
appwrite-certificates:
appwrite-influxdb:
appwrite-traefik:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -10,7 +10,7 @@
z-index: 1002;
margin: 0 auto;
bottom: 15px;
max-width: 540px;
max-width: 560px;
li {
margin: 10px 0 0 0;

20
traefik.yml Normal file
View file

@ -0,0 +1,20 @@
xhttp:
middlewares:
demoHeader:
headers:
customRequestHeaders:
X-Script-Name: "test2"
customResponseHeaders:
X-Custom-Response-Header: "value2"
tls:
certificates:
- certFile: /certs/default.crt
keyFile: /certs/default.key
# tls:
# certificates:
# - certFile: /path/to/domain.cert
# keyFile: /path/to/domain.key
# - certFile: /path/to/other-domain.cert
# keyFile: /path/to/other-domain.key