diff --git a/build.sh b/.travis-ci/build.sh similarity index 100% rename from build.sh rename to .travis-ci/build.sh diff --git a/.travis-ci/deploy.sh b/.travis-ci/deploy.sh new file mode 100644 index 0000000000..b4c132022a --- /dev/null +++ b/.travis-ci/deploy.sh @@ -0,0 +1 @@ +echo 'Nothing to deploy right now.' \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index afb64c0c8c..8406222a16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,11 @@ +dist: xenial + arch: - amd64 os: linux -language: minimal +language: shell notifications: email: @@ -23,6 +25,8 @@ before_install: echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin fi - docker --version +- docker buildx create --use +- chmod -R u+x ./.travis-ci install: - docker-compose up -d @@ -34,3 +38,11 @@ script: - docker-compose exec appwrite doctor - docker-compose exec appwrite vars - docker-compose exec appwrite test + +deploy: + - provider: script + edge: true + script: ./.travis-ci/deploy.sh + on: + repo: appwrite/appwrite + branch: deploy diff --git a/app/config/environments.php b/app/config/environments.php index 228e7e4608..3e483829b7 100644 --- a/app/config/environments.php +++ b/app/config/environments.php @@ -3,7 +3,7 @@ * List of Appwrite Cloud Functions supported environments */ return [ - 'node-14' => [ + 'node-14.5' => [ 'name' => 'Node.js', 'version' => '14.5', 'base' => 'node:14.5-alpine', @@ -11,6 +11,14 @@ return [ 'build' => '/usr/src/code/docker/environments/node-14.5', 'logo' => 'node.png', ], + 'node-15.5' => [ + 'name' => 'Node.js', + 'version' => '15.5', + 'base' => 'node:15.5-alpine', + 'image' => 'appwrite/env-node-15.5:1.0.0', + 'build' => '/usr/src/code/docker/environments/node-15.5', + 'logo' => 'node.png', + ], 'php-7.4' => [ 'name' => 'PHP', 'version' => '7.4', @@ -35,6 +43,14 @@ return [ 'build' => '/usr/src/code/docker/environments/ruby-2.7', 'logo' => 'ruby.png', ], + 'ruby-3.0' => [ + 'name' => 'Ruby', + 'version' => '3.0', + 'base' => 'ruby:3.0-alpine', + 'image' => 'appwrite/env-ruby-3.0:1.0.0', + 'build' => '/usr/src/code/docker/environments/ruby-3.0', + 'logo' => 'ruby.png', + ], 'python-3.8' => [ 'name' => 'Python', 'version' => '3.8', @@ -59,6 +75,14 @@ return [ 'build' => '/usr/src/code/docker/environments/deno-1.5', 'logo' => 'deno.png', ], + 'deno-1.6' => [ + 'name' => 'Deno', + 'version' => '1.6', + 'base' => 'hayd/deno:alpine-1.6.0', + 'image' => 'appwrite/env-deno-1.6:1.0.0', + 'build' => '/usr/src/code/docker/environments/deno-1.6', + 'logo' => 'deno.png', + ], // 'dart-2.8' => [ // 'name' => 'Dart', // 'version' => '2.8', diff --git a/app/controllers/general.php b/app/controllers/general.php index 0ac19d5897..445563301d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -51,7 +51,11 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo $port = \parse_url($request->getOrigin($referrer), PHP_URL_PORT); $refDomain = (!empty($protocol) ? $protocol : $request->getProtocol()).'://'.((\in_array($origin, $clients)) - ? $origin : 'localhost') . (!empty($port) ? ':'.$port : ''); + ? $origin : 'localhost').(!empty($port) ? ':'.$port : ''); + + $refDomain = (!$route->getLabel('origin', false)) // This route is publicly accessible + ? $refDomain + : (!empty($protocol) ? $protocol : $request->getProtocol()).'://'.$origin.(!empty($port) ? ':'.$port : ''); $selfDomain = new Domain($request->getHostname()); $endDomain = new Domain((string)$origin); @@ -110,7 +114,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo } $response->addHeader('Strict-Transport-Security', 'max-age='.(60 * 60 * 24 * 126)); // 126 days - } + } $response ->addHeader('Server', 'Appwrite') diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index f8786bcac8..34c34cfb83 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -4,23 +4,13 @@ global $cli; require_once __DIR__.'/../init.php'; -use Appwrite\Database\Database; -use Appwrite\Database\Adapter\MySQL as MySQLAdapter; -use Appwrite\Database\Adapter\Redis as RedisAdapter; use Appwrite\Event\Event; use Utopia\App; use Utopia\CLI\Console; -use Utopia\Config\Config; -// TODO: Think of a better way to access consoleDB -function getConsoleDB() { - global $register; - $consoleDB = new Database(); - $consoleDB->setAdapter(new RedisAdapter(new MySQLAdapter($register), $register)); - $consoleDB->setNamespace('app_console'); // Main DB - $consoleDB->setMocks(Config::getParam('collections', [])); - return $consoleDB; -} +Console::title('Maintenance V1'); + +Console::success(APP_NAME.' maintenance process v1 has started'); function notifyDeleteExecutionLogs() { @@ -51,17 +41,14 @@ $cli ->action(function () { // # of days in seconds (1 day = 86400s) $interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); - //Convert Seconds to microseconds - $intervalMicroseconds = $interval * 1000000; - $consoleDB = getConsoleDB(); - - Console::loop(function() use ($consoleDB, $interval){ - Console::info("[ MAINTENANCE TASK ] Notifying deletes workers every {$interval} seconds"); + Console::loop(function() use ($interval){ + $time = date('d-m-Y H:i:s', time()); + Console::info("[{$time}] Notifying deletes workers every {$interval} seconds"); notifyDeleteExecutionLogs(); notifyDeleteAbuseLogs($interval); notifyDeleteAuditLogs($interval); - }, $intervalMicroseconds); + }, $interval); }); \ No newline at end of file diff --git a/app/views/console/account/index.phtml b/app/views/console/account/index.phtml index 84a18521de..3f1e7decc9 100644 --- a/app/views/console/account/index.phtml +++ b/app/views/console/account/index.phtml @@ -29,6 +29,8 @@