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

Added workers as containers

This commit is contained in:
Eldad Fux 2020-07-05 16:51:20 +03:00
parent a89aecb524
commit a68e86464b
12 changed files with 131 additions and 50 deletions

20
.env Normal file
View file

@ -0,0 +1,20 @@
_APP_ENV=production
_APP_ENV=development
_APP_OPTIONS_ABUSE=disabled
_APP_OPTIONS_FORCE_HTTPS=disabled
_APP_OPENSSL_KEY_V1=your-secret-key
_APP_DOMAIN=demo.appwrite.io
_APP_DOMAIN_TARGET=demo.appwrite.io
_APP_REDIS_HOST=redis
_APP_REDIS_PORT=6379
_APP_DB_HOST=mariadb
_APP_DB_PORT=3306
_APP_DB_SCHEMA=appwrite
_APP_DB_USER=user
_APP_DB_PASS=password
_APP_INFLUXDB_HOST=influxdb
_APP_INFLUXDB_PORT=8086
_APP_STATSD_HOST=telegraf
_APP_STATSD_PORT=8125
_APP_SMTP_HOST=maildev
_APP_SMTP_PORT=25

3
.gitignore vendored
View file

@ -8,5 +8,4 @@
/tests/resources/storage/
/.idea/
.DS_Store
.php_cs.cache
.env
.php_cs.cache

View file

@ -140,6 +140,14 @@ RUN chmod +x /usr/local/bin/start
RUN chmod +x /usr/local/bin/doctor
RUN chmod +x /usr/local/bin/migrate
RUN chmod +x /usr/local/bin/test
RUN chmod +x /usr/local/bin/schedule
RUN chmod +x /usr/local/bin/worker-audits
RUN chmod +x /usr/local/bin/worker-certificates
RUN chmod +x /usr/local/bin/worker-deletes
RUN chmod +x /usr/local/bin/worker-mails
RUN chmod +x /usr/local/bin/worker-tasks
RUN chmod +x /usr/local/bin/worker-usage
RUN chmod +x /usr/local/bin/worker-webhooks
# Letsencrypt Permissions
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/

3
bin/schedule Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' RESQUE_PHP='/usr/src/code/vendor/autoload.php' php /usr/src/code/vendor/bin/resque-scheduler

3
bin/worker-audits Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
QUEUE='v1-audits' APP_INCLUDE='/usr/src/code/app/workers/audits.php' REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' php /usr/src/code/vendor/bin/resque

3
bin/worker-certificates Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
QUEUE='v1-certificates' APP_INCLUDE='/usr/src/code/app/workers/certificates.php' REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' php /usr/src/code/vendor/bin/resque

3
bin/worker-deletes Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
QUEUE='v1-deletes' APP_INCLUDE='/usr/src/code/app/workers/deletes.php' REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' php /usr/src/code/vendor/bin/resque

3
bin/worker-mails Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
QUEUE='v1-mails' APP_INCLUDE='/usr/src/code/app/workers/mails.php' REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' php /usr/src/code/vendor/bin/resque

3
bin/worker-tasks Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
QUEUE='v1-usage' APP_INCLUDE='/usr/src/code/app/workers/usage.php' REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' php /usr/src/code/vendor/bin/resque

View file

@ -0,0 +1,3 @@
#!/bin/bash
QUEUE='v1-usage' APP_INCLUDE='/usr/src/code/app/workers/usage.php' REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' php /usr/src/code/vendor/bin/resque

3
bin/worker-webhooks Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
QUEUE='v1-webhooks' APP_INCLUDE='/usr/src/code/app/workers/webhooks.php' REDIS_BACKEND='${_APP_REDIS_HOST}:${_APP_REDIS_PORT}' php /usr/src/code/vendor/bin/resque

View file

@ -61,31 +61,61 @@ services:
- mariadb
- redis
# - smtp
- maildev
- clamav
- influxdb
- telegraf
- maildev
environment:
#- _APP_ENV=production
- _APP_ENV=development
- _APP_OPTIONS_ABUSE=disabled
- _APP_OPTIONS_FORCE_HTTPS=disabled
- _APP_OPENSSL_KEY_V1=your-secret-key
- _APP_DOMAIN=demo.appwrite.io
- _APP_DOMAIN_TARGET=demo.appwrite.io
- _APP_REDIS_HOST=redis
- _APP_REDIS_PORT=6379
- _APP_DB_HOST=mariadb
- _APP_DB_PORT=3306
- _APP_DB_SCHEMA=appwrite
- _APP_DB_USER=user
- _APP_DB_PASS=password
- _APP_INFLUXDB_HOST=influxdb
- _APP_INFLUXDB_PORT=8086
- _APP_STATSD_HOST=telegraf
- _APP_STATSD_PORT=8125
- _APP_SMTP_HOST=maildev
- _APP_SMTP_PORT=25
- _APP_ENV
- _APP_OPTIONS_ABUSE
- _APP_OPTIONS_FORCE_HTTPS
- _APP_OPENSSL_KEY_V1
- _APP_DOMAIN
- _APP_DOMAIN_TARGET
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_INFLUXDB_HOST
- _APP_INFLUXDB_PORT
appwrite-worker-usage:
entrypoint: worker-usage
container_name: appwrite-worker-usage
build:
context: .
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
environment:
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_STATSD_HOST
- _APP_STATSD_PORT
appwrite-worker-webhooks:
entrypoint: worker-webhooks
container_name: appwrite-worker-webhooks
build:
context: .
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
environment:
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
mariadb:
image: appwrite/mariadb:1.0.3 # fix issues when upgrading using: mysql_upgrade -u root -p
@ -99,9 +129,9 @@ services:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=rootsecretpassword
- MYSQL_DATABASE=appwrite
- MYSQL_USER=user
- MYSQL_PASSWORD=password
- MYSQL_DATABASE="${_APP_DB_SCHEMA}"
- MYSQL_USER="${_APP_DB_USER}"
- MYSQL_PASSWORD="${_APP_DB_PASS}"
command: 'mysqld --innodb-flush-method=fsync'
maildev:
@ -180,31 +210,31 @@ services:
# - RESQUE_WEB_HTTP_BASIC_AUTH_USER=user
# - RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD=password
chronograf:
image: chronograf:1.5
container_name: appwrite_chronograf
restart: unless-stopped
networks:
- appwrite
volumes:
- appwrite-chronograf:/var/lib/chronograf
ports:
- "8888:8888"
environment:
- INFLUXDB_URL=http://influxdb:8086
- KAPACITOR_URL=http://kapacitor:9092
- AUTH_DURATION=48h
- TOKEN_SECRET=duperduper5674829!jwt
- GH_CLIENT_ID=d86f7145a41eacfc52cc
- GH_CLIENT_SECRET=9e0081062367a2134e7f2ea95ba1a32d08b6c8ab
- GH_ORGS=appwrite
# chronograf:
# image: chronograf:1.5
# container_name: appwrite_chronograf
# restart: unless-stopped
# networks:
# - appwrite
# volumes:
# - appwrite-chronograf:/var/lib/chronograf
# ports:
# - "8888:8888"
# environment:
# - INFLUXDB_URL=http://influxdb:8086
# - KAPACITOR_URL=http://kapacitor:9092
# - AUTH_DURATION=48h
# - TOKEN_SECRET=duperduper5674829!jwt
# - GH_CLIENT_ID=d86f7145a41eacfc52cc
# - GH_CLIENT_SECRET=9e0081062367a2134e7f2ea95ba1a32d08b6c8ab
# - GH_ORGS=appwrite
webgrind:
image: 'jokkedk/webgrind:latest'
volumes:
- './debug:/tmp'
ports:
- '3001:80'
# webgrind:
# image: 'jokkedk/webgrind:latest'
# volumes:
# - './debug:/tmp'
# ports:
# - '3001:80'
networks:
gateway: