Merge branch 'feat-db-pools' of https://github.com/appwrite/appwrite into feat-usage-refactor-fo-db-pools

This commit is contained in:
Damodar Lohani
2022-11-09 01:21:04 +00:00
8 changed files with 70 additions and 7 deletions
+2 -2
View File
@@ -23,8 +23,8 @@ _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=mariadb://user:password@mariadb:3306/appwrite
_APP_CONNECTIONS_DB_CONSOLE=db_fra1_01=mariadb://user:password@mariadb: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
+2
View File
@@ -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 && \
+1
View File
@@ -108,6 +108,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';
+3 -3
View File
@@ -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,
-1
View File
@@ -20,7 +20,6 @@ use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\DateTime;
use Utopia\Database\Query;
use Utopia\Database\Adapter\MySQL;
use Utopia\Database\Validator\Authorization;
use Utopia\Database\Validator\Key;
use Utopia\Database\Validator\Permissions;
+45
View 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
View File
@@ -0,0 +1,3 @@
#!/bin/sh
php /usr/src/code/app/cli.php volume-sync $@
+14 -1
View File
@@ -645,6 +645,19 @@ services:
- _APP_MAINTENANCE_RETENTION_AUDIT
- _APP_MAINTENANCE_RETENTION_USAGE_HOURLY
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:
entrypoint: usage
<<: *x-logging
@@ -702,7 +715,7 @@ services:
mariadb:
image: mariadb:10.7 # fix issues when upgrading using: mysql_upgrade -u root -p
container_name: appwrite-mariadb
container_name: mariadb
<<: *x-logging
networks:
- appwrite