From 4dc7204e8bdd4397a15ed34d5b7329e1bed959e4 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 29 Jan 2021 13:32:20 +0100 Subject: [PATCH 1/6] sync --- app/config/variables.php | 4 ++-- app/tasks/install.php | 1 + app/views/install/compose.phtml | 5 +---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 011164db25..5a5e0e951b 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -165,7 +165,7 @@ return [ ], [ 'name' => '_APP_DB_USER', - 'description' => 'MariaDB server user name. Default value is: \'root\'.', + 'description' => 'MariaDB server user name. Default value is: \'user\'.', 'introduction' => '', 'default' => 'user', 'required' => false, @@ -341,7 +341,7 @@ return [ 'name' => '_APP_FUNCTIONS_MEMORY', 'description' => 'The maximum amount of memory a single cloud function is allowed to use in megabytes. The default value is 128.', 'introduction' => '0.7.0', - 'default' => '128', + 'default' => '256', 'required' => false, 'question' => '', ], diff --git a/app/tasks/install.php b/app/tasks/install.php index 4cb5341f0a..d202787441 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -30,6 +30,7 @@ $cli * 5. Run docker-compose up -d - DONE * 6. Run data migration */ + $version = "0.7.0"; $config = Config::getParam('variables'); $path = '/usr/src/code/appwrite'; $defaultHTTPPort = '80'; diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 9a182cc628..9d5c3d084a 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -266,10 +266,9 @@ services: - _APP_SMTP_PASSWORD appwrite-maintenance: + image: appwrite/appwrite: entrypoint: maintenance container_name: appwrite-maintenance - build: - context: . restart: unless-stopped networks: - appwrite @@ -307,8 +306,6 @@ services: - appwrite volumes: - appwrite-mariadb:/var/lib/mysql:rw - ports: - - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=rootsecretpassword - MYSQL_DATABASE=${_APP_DB_SCHEMA} From 8598a06f20ac6599ce89f9639b10a8d43b85cb82 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 29 Jan 2021 16:52:16 +0100 Subject: [PATCH 2/6] fix(install): add .env varaibles to docker-compose --- app/tasks/install.php | 1 + app/views/install/compose.phtml | 35 ++++----------------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index d202787441..c470bceee3 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -132,6 +132,7 @@ $cli ->setParam('httpPort', $httpPort) ->setParam('httpsPort', $httpsPort) ->setParam('version', $version) + ->setParam('vars', $input) ; $templateForEnv diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 9d5c3d084a..ee45e32e23 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -3,6 +3,7 @@ $httpPort = $this->getParam('httpPort', ''); $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); +$vars = $this->getParam('vars'); ?>version: '3' services: @@ -55,37 +56,9 @@ services: - clamav - influxdb environment: - - _APP_ENV - - _APP_SYSTEM_EMAIL_NAME - - _APP_SYSTEM_EMAIL_ADDRESS - - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS - - _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_SMTP_HOST - - _APP_SMTP_PORT - - _APP_SMTP_SECURE - - _APP_SMTP_USERNAME - - _APP_SMTP_PASSWORD - - _APP_USAGE_STATS - - _APP_INFLUXDB_HOST - - _APP_INFLUXDB_PORT - - _APP_STORAGE_LIMIT - - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_CONTAINERS - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY - - _APP_FUNCTIONS_MEMORY_SWAP - - _APP_FUNCTIONS_ENVS + $value) { + echo ' - '.$key.'=${'.$key."}\n"; +}?> appwrite-worker-usage: image: appwrite/appwrite: From 1ff1105703ddb0eed4e183925b5b031b36dc88e8 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 29 Jan 2021 17:03:33 +0100 Subject: [PATCH 3/6] revert stupid change and fix it smart --- app/tasks/install.php | 4 ++-- app/views/install/compose.phtml | 35 +++++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index c470bceee3..1ecbc4ba3c 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -152,9 +152,9 @@ $cli $stdout = ''; $stderr = ''; - Console::log("Running \"docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes\""); + Console::log("Running \"docker-compose -f {$path}/docker-compose.yml up -d --env-file={$path}/.env --remove-orphans --renew-anon-volumes\""); - $exit = Console::execute("docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); + $exit = Console::execute("docker-compose -f {$path}/docker-compose.yml up -d --env-file={$path}/.env --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); if ($exit !== 0) { Console::error("Failed to install Appwrite dockers"); diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index ee45e32e23..9d5c3d084a 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -3,7 +3,6 @@ $httpPort = $this->getParam('httpPort', ''); $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); -$vars = $this->getParam('vars'); ?>version: '3' services: @@ -56,9 +55,37 @@ services: - clamav - influxdb environment: - $value) { - echo ' - '.$key.'=${'.$key."}\n"; -}?> + - _APP_ENV + - _APP_SYSTEM_EMAIL_NAME + - _APP_SYSTEM_EMAIL_ADDRESS + - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS + - _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_SMTP_HOST + - _APP_SMTP_PORT + - _APP_SMTP_SECURE + - _APP_SMTP_USERNAME + - _APP_SMTP_PASSWORD + - _APP_USAGE_STATS + - _APP_INFLUXDB_HOST + - _APP_INFLUXDB_PORT + - _APP_STORAGE_LIMIT + - _APP_FUNCTIONS_TIMEOUT + - _APP_FUNCTIONS_CONTAINERS + - _APP_FUNCTIONS_CPUS + - _APP_FUNCTIONS_MEMORY + - _APP_FUNCTIONS_MEMORY_SWAP + - _APP_FUNCTIONS_ENVS appwrite-worker-usage: image: appwrite/appwrite: From a95c763e7e6c6bf0d506f0dce959fd765f693671 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 29 Jan 2021 18:12:59 +0100 Subject: [PATCH 4/6] fix env variables on install --- app/tasks/install.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 1ecbc4ba3c..99648d1e2f 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -30,7 +30,6 @@ $cli * 5. Run docker-compose up -d - DONE * 6. Run data migration */ - $version = "0.7.0"; $config = Config::getParam('variables'); $path = '/usr/src/code/appwrite'; $defaultHTTPPort = '80'; @@ -149,12 +148,19 @@ $cli Console::exit(1); } + $env = ''; $stdout = ''; $stderr = ''; - Console::log("Running \"docker-compose -f {$path}/docker-compose.yml up -d --env-file={$path}/.env --remove-orphans --renew-anon-volumes\""); + foreach ($input as $key => $value) { + if($value) { + $env .= $key.'='.$value.' '; + } + } - $exit = Console::execute("docker-compose -f {$path}/docker-compose.yml up -d --env-file={$path}/.env --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); + Console::log("Running \"docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes\""); + + $exit = Console::execute("${env} docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); if ($exit !== 0) { Console::error("Failed to install Appwrite dockers"); From e0f6613b9e183a576a11cd0560b201ec99f52ed6 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 29 Jan 2021 18:38:57 +0100 Subject: [PATCH 5/6] remove from install script --- app/tasks/install.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 99648d1e2f..7cf0871514 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -12,8 +12,7 @@ use Utopia\View; $cli ->task('install') ->desc('Install Appwrite') - ->param('version', APP_VERSION_STABLE, new Mock(), 'Appwrite version', true) - ->action(function ($version) { + ->action(function () { /** * 1. Start - DONE * 2. Check for older setup and get older version - DONE @@ -130,7 +129,7 @@ $cli $templateForCompose ->setParam('httpPort', $httpPort) ->setParam('httpsPort', $httpsPort) - ->setParam('version', $version) + ->setParam('version', APP_VERSION_STABLE) ->setParam('vars', $input) ; From 5439343748c5fbf1d5d916962dc1a9335be68989 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Fri, 29 Jan 2021 18:40:52 +0100 Subject: [PATCH 6/6] remove leftovers --- app/tasks/install.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 7cf0871514..f855a086cf 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -6,7 +6,6 @@ use Appwrite\Docker\Compose; use Appwrite\Docker\Env; use Utopia\CLI\Console; use Utopia\Config\Config; -use Utopia\Validator\Mock; use Utopia\View; $cli @@ -130,7 +129,6 @@ $cli ->setParam('httpPort', $httpPort) ->setParam('httpsPort', $httpsPort) ->setParam('version', APP_VERSION_STABLE) - ->setParam('vars', $input) ; $templateForEnv