diff --git a/.env b/.env index 950fd44821..b28a75a9de 100644 --- a/.env +++ b/.env @@ -17,14 +17,14 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_HOST=mariadb +_APP_DB_HOST=mysql _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite _APP_DB_USER=user _APP_DB_PASS=password _APP_DB_ROOT_PASS=rootsecretpassword -_APP_CONNECTIONS_DB_PROJECT=db_fra1_02=mysql://user:password@mariadb:3306/appwrite -_APP_CONNECTIONS_DB_CONSOLE=db_fra1_01=mysql://user:password@mariadb:3306/appwrite +_APP_CONNECTIONS_DB_PROJECT=db_fra1_02=mysql://user:password@mysql:3306/appwrite +_APP_CONNECTIONS_DB_CONSOLE=db_fra1_01=mysql://user:password@mysql:3306/appwrite _APP_CONNECTIONS_CACHE=redis_fra1_01=redis://redis:6379 _APP_CONNECTIONS_QUEUE=redis_fra1_01=redis://redis:6379 _APP_CONNECTIONS_PUBSUB=redis_fra1_01=redis://redis:6379 diff --git a/Dockerfile b/Dockerfile index 410fb1c44c..3910bc61a1 100755 --- a/Dockerfile +++ b/Dockerfile @@ -281,6 +281,7 @@ RUN \ && apk add --no-cache \ libstdc++ \ certbot \ + rsync \ brotli-dev \ yaml-dev \ imagemagick \ @@ -343,6 +344,7 @@ RUN mkdir -p /storage/uploads && \ # Executables RUN chmod +x /usr/local/bin/doctor && \ chmod +x /usr/local/bin/maintenance && \ + chmod +x /usr/local/bin/volume-sync && \ chmod +x /usr/local/bin/usage && \ chmod +x /usr/local/bin/install && \ chmod +x /usr/local/bin/migrate && \ diff --git a/app/cli.php b/app/cli.php index 3a62c80816..1b51282348 100644 --- a/app/cli.php +++ b/app/cli.php @@ -85,6 +85,7 @@ $cli = new CLI(); include 'tasks/doctor.php'; include 'tasks/maintenance.php'; +include 'tasks/volume-sync.php'; include 'tasks/install.php'; include 'tasks/migrate.php'; include 'tasks/sdks.php'; diff --git a/app/config/collections.php b/app/config/collections.php index 2a01acc8e5..b4fabf0e65 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2325,7 +2325,7 @@ $collections = [ '$id' => ID::custom('entrypoint'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 2048, 'signed' => true, 'required' => false, 'default' => null, @@ -2335,7 +2335,7 @@ $collections = [ '$id' => ID::custom('path'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 2048, 'signed' => true, 'required' => false, 'default' => null, @@ -2907,7 +2907,7 @@ $collections = [ '$id' => 'compression', 'type' => Database::VAR_STRING, 'signed' => true, - 'size' => 128, + 'size' => 10, 'format' => '', 'filters' => [], 'required' => true, diff --git a/app/tasks/volume-sync.php b/app/tasks/volume-sync.php new file mode 100644 index 0000000000..8d5fec201b --- /dev/null +++ b/app/tasks/volume-sync.php @@ -0,0 +1,45 @@ +task('volume-sync') + ->desc('Runs rsync to sync certificates between the storage mount and traefik.') + ->param('source', null, new Text(255), 'Source path to sync from.', false) + ->param('destination', null, new Text(255), 'Destination path to sync to.', false) + ->param('interval', null, new Integer(true), 'Interval to run rsync', false) + ->action(function ($source, $destination, $interval) { + + Console::title('RSync V1'); + Console::success(APP_NAME . ' rsync process v1 has started'); + + if (!file_exists($source)) { + Console::error('Source directory does not exist. Exiting ... '); + Console::exit(0); + } + + Console::loop(function () use ($interval, $source, $destination) { + $time = DateTime::now(); + + Console::info("[{$time}] Executing rsync every {$interval} seconds"); + Console::info("Syncing between $source and $destination"); + + if (!file_exists($source)) { + Console::error('Source directory does not exist. Skipping ... '); + return; + } + + $stdin = ""; + $stdout = ""; + $stderr = ""; + + Console::execute("rsync -av $source $destination", $stdin, $stdout, $stderr); + Console::success($stdout); + Console::error($stderr); + }, $interval); + }); diff --git a/bin/volume-sync b/bin/volume-sync new file mode 100644 index 0000000000..5190750a24 --- /dev/null +++ b/bin/volume-sync @@ -0,0 +1,3 @@ +#!/bin/sh + +php /usr/src/code/app/cli.php volume-sync $@ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 34a9d5993c..f6687493aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -85,7 +85,7 @@ services: - ./src:/usr/src/code/src - ./dev:/usr/local/dev depends_on: - - mariadb + - mysql - redis # - clamav entrypoint: @@ -208,7 +208,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - mysql - redis environment: - _APP_ENV @@ -244,7 +244,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - mysql environment: - _APP_ENV - _APP_OPENSSL_KEY_V1 @@ -276,7 +276,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - mysql - request-catcher environment: - _APP_ENV @@ -299,7 +299,7 @@ services: - appwrite depends_on: - redis - - mariadb + - mysql volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -362,7 +362,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - mysql environment: - _APP_ENV - _APP_OPENSSL_KEY_V1 @@ -394,7 +394,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - mysql environment: - _APP_ENV - _APP_OPENSSL_KEY_V1 @@ -425,7 +425,7 @@ services: - appwrite depends_on: - redis - - mariadb + - mysql volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw @@ -465,7 +465,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - mysql - appwrite-executor environment: - _APP_ENV @@ -510,7 +510,7 @@ services: - /tmp:/tmp:rw depends_on: - redis - - mariadb + - mysql - appwrite environment: - _APP_ENV @@ -642,6 +642,19 @@ services: - _APP_MAINTENANCE_RETENTION_ABUSE - _APP_MAINTENANCE_RETENTION_AUDIT + appwrite-volume-sync: + entrypoint: volume-sync + <<: *x-logging + container_name: appwrite-volume-sync + image: appwrite-dev + command: + - --source=/data/src/ --destination=/data/dest/ --interval=10 + networks: + - appwrite + # volumes: # Mount the rsync source and destination directories + # - /nfs/config:/data/src + # - /storage/config:/data/dest + appwrite-usage-timeseries: entrypoint: - usage @@ -657,7 +670,7 @@ services: - ./dev:/usr/local/dev depends_on: - influxdb - - mariadb + - mysql environment: - _APP_ENV - _APP_OPENSSL_KEY_V1 @@ -695,7 +708,7 @@ services: - ./dev:/usr/local/dev depends_on: - influxdb - - mariadb + - mysql environment: - _APP_ENV - _APP_OPENSSL_KEY_V1 @@ -738,14 +751,14 @@ services: - _APP_REDIS_PASS - _APP_CONNECTIONS_QUEUE - mariadb: - image: mariadb:10.7 # fix issues when upgrading using: mysql_upgrade -u root -p - container_name: appwrite-mariadb + mysql: + image: mysql:8.0.28-oracle # fix issues when upgrading using: mysql_upgrade -u root -p + container_name: appwrite-mysql <<: *x-logging networks: - appwrite volumes: - - appwrite-mariadb:/var/lib/mysql:rw + - appwrite-mysql:/var/lib/mysql:rw ports: - "3306:3306" environment: @@ -904,7 +917,7 @@ networks: runtimes: volumes: - appwrite-mariadb: + appwrite-mysql: appwrite-redis: appwrite-cache: appwrite-uploads: