diff --git a/.env b/.env new file mode 100644 index 0000000000..9ab53a967e --- /dev/null +++ b/.env @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index fa6a24789b..16ce41ad7f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,4 @@ /tests/resources/storage/ /.idea/ .DS_Store -.php_cs.cache -.env \ No newline at end of file +.php_cs.cache \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5253f135a8..7041d47da9 100755 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/bin/schedule b/bin/schedule new file mode 100644 index 0000000000..753ddd3ef9 --- /dev/null +++ b/bin/schedule @@ -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 \ No newline at end of file diff --git a/bin/worker-audits b/bin/worker-audits new file mode 100644 index 0000000000..481ef3c13c --- /dev/null +++ b/bin/worker-audits @@ -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 \ No newline at end of file diff --git a/bin/worker-certificates b/bin/worker-certificates new file mode 100644 index 0000000000..ddd8bb0886 --- /dev/null +++ b/bin/worker-certificates @@ -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 \ No newline at end of file diff --git a/bin/worker-deletes b/bin/worker-deletes new file mode 100644 index 0000000000..f02878de94 --- /dev/null +++ b/bin/worker-deletes @@ -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 \ No newline at end of file diff --git a/bin/worker-mails b/bin/worker-mails new file mode 100644 index 0000000000..18c9f725bf --- /dev/null +++ b/bin/worker-mails @@ -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 \ No newline at end of file diff --git a/bin/worker-tasks b/bin/worker-tasks new file mode 100644 index 0000000000..f326079308 --- /dev/null +++ b/bin/worker-tasks @@ -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 \ No newline at end of file diff --git a/bin/worker-usage b/bin/worker-usage index e69de29bb2..f326079308 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -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 \ No newline at end of file diff --git a/bin/worker-webhooks b/bin/worker-webhooks new file mode 100644 index 0000000000..22e6858236 --- /dev/null +++ b/bin/worker-webhooks @@ -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 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 61f9386bc8..81e043f088 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: