Merge pull request #4284 from appwrite/feat-mysql-test
feat: mysql support
This commit is contained in:
commit
d957832904
7 changed files with 87 additions and 23 deletions
6
.env
6
.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
|
||||
|
|
|
@ -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 && \
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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,
|
||||
|
|
45
app/tasks/volume-sync.php
Normal file
45
app/tasks/volume-sync.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
global $cli;
|
||||
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Validator\Integer;
|
||||
use Utopia\Validator\Text;
|
||||
|
||||
$cli
|
||||
->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);
|
||||
});
|
3
bin/volume-sync
Normal file
3
bin/volume-sync
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
php /usr/src/code/app/cli.php volume-sync $@
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue