Added functions worker standalone container
This commit is contained in:
parent
757a7935cc
commit
b70e185450
|
@ -146,6 +146,7 @@ RUN chmod +x /usr/local/bin/test
|
|||
RUN chmod +x /usr/local/bin/worker-audits
|
||||
RUN chmod +x /usr/local/bin/worker-certificates
|
||||
RUN chmod +x /usr/local/bin/worker-deletes
|
||||
RUN chmod +x /usr/local/bin/worker-functions
|
||||
RUN chmod +x /usr/local/bin/worker-mails
|
||||
RUN chmod +x /usr/local/bin/worker-tasks
|
||||
RUN chmod +x /usr/local/bin/worker-usage
|
||||
|
|
|
@ -146,6 +146,7 @@ RUN chmod +x /usr/local/bin/test
|
|||
RUN chmod +x /usr/local/bin/worker-audits
|
||||
RUN chmod +x /usr/local/bin/worker-certificates
|
||||
RUN chmod +x /usr/local/bin/worker-deletes
|
||||
RUN chmod +x /usr/local/bin/worker-functions
|
||||
RUN chmod +x /usr/local/bin/worker-mails
|
||||
RUN chmod +x /usr/local/bin/worker-tasks
|
||||
RUN chmod +x /usr/local/bin/worker-usage
|
||||
|
|
|
@ -146,6 +146,7 @@ RUN chmod +x /usr/local/bin/test
|
|||
RUN chmod +x /usr/local/bin/worker-audits
|
||||
RUN chmod +x /usr/local/bin/worker-certificates
|
||||
RUN chmod +x /usr/local/bin/worker-deletes
|
||||
RUN chmod +x /usr/local/bin/worker-functions
|
||||
RUN chmod +x /usr/local/bin/worker-mails
|
||||
RUN chmod +x /usr/local/bin/worker-tasks
|
||||
RUN chmod +x /usr/local/bin/worker-usage
|
||||
|
|
|
@ -146,6 +146,7 @@ RUN chmod +x /usr/local/bin/test
|
|||
RUN chmod +x /usr/local/bin/worker-audits
|
||||
RUN chmod +x /usr/local/bin/worker-certificates
|
||||
RUN chmod +x /usr/local/bin/worker-deletes
|
||||
RUN chmod +x /usr/local/bin/worker-functions
|
||||
RUN chmod +x /usr/local/bin/worker-mails
|
||||
RUN chmod +x /usr/local/bin/worker-tasks
|
||||
RUN chmod +x /usr/local/bin/worker-usage
|
||||
|
|
|
@ -435,7 +435,9 @@ App::post('/v1/functions/:functionId/executions')
|
|||
}
|
||||
|
||||
if((bool)$async) {
|
||||
|
||||
// Issue a TLS certificate when domain is verified
|
||||
Resque::enqueue('v1-functions', 'FunctionsV1', [
|
||||
]);
|
||||
}
|
||||
|
||||
$response
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Config\Config;
|
||||
use Appwrite\Database\Database;
|
||||
use Appwrite\Database\Validator\Authorization;
|
||||
|
||||
require_once __DIR__.'/../init.php';
|
||||
|
||||
|
@ -13,7 +11,9 @@ Console::success(APP_NAME.' functions worker v1 has started');
|
|||
|
||||
$environments = Config::getParam('environments');
|
||||
|
||||
foreach($environments as $environment) {
|
||||
$warmupStart = microtime(true);
|
||||
|
||||
foreach($environments as $environment) { // Warmup: make sure images are ready to run fast 🚀
|
||||
$stdout = '';
|
||||
$stderr = '';
|
||||
|
||||
|
@ -22,7 +22,7 @@ foreach($environments as $environment) {
|
|||
Console::execute('docker pull '.$environment['image'], null, $stdout, $stderr);
|
||||
|
||||
if(!empty($stdout)) {
|
||||
Console::success($stdout);
|
||||
Console::log($stdout);
|
||||
}
|
||||
|
||||
if(!empty($stderr)) {
|
||||
|
@ -30,6 +30,11 @@ foreach($environments as $environment) {
|
|||
}
|
||||
}
|
||||
|
||||
$warmupEnd = microtime(true);
|
||||
$warmupTime = $warmupEnd - $warmupStart;
|
||||
|
||||
Console::success('Finished warmup in '.$warmupTime.' seconds');
|
||||
|
||||
class FunctionsV1
|
||||
{
|
||||
public $args = [];
|
||||
|
|
3
bin/worker-functions
Normal file
3
bin/worker-functions
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
QUEUE='v1-functions' APP_INCLUDE='/usr/src/code/app/workers/functions.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -210,6 +210,25 @@ services:
|
|||
- _APP_DB_USER
|
||||
- _APP_DB_PASS
|
||||
|
||||
appwrite-worker-functions:
|
||||
entrypoint: worker-functions
|
||||
container_name: appwrite-worker-functions
|
||||
build:
|
||||
context: .
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
depends_on:
|
||||
- redis
|
||||
- mariadb
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- appwrite-functions:/storage/functions:rw
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_REDIS_HOST
|
||||
- _APP_REDIS_PORT
|
||||
|
||||
appwrite-worker-mails:
|
||||
entrypoint: worker-mails
|
||||
container_name: appwrite-worker-mails
|
||||
|
|
|
@ -210,6 +210,25 @@ services:
|
|||
- _APP_DB_USER
|
||||
- _APP_DB_PASS
|
||||
|
||||
appwrite-worker-functions:
|
||||
entrypoint: worker-functions
|
||||
container_name: appwrite-worker-functions
|
||||
build:
|
||||
context: .
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
depends_on:
|
||||
- redis
|
||||
- mariadb
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- appwrite-functions:/storage/functions:rw
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_REDIS_HOST
|
||||
- _APP_REDIS_PORT
|
||||
|
||||
appwrite-worker-mails:
|
||||
entrypoint: worker-mails
|
||||
container_name: appwrite-worker-mails
|
||||
|
|
|
@ -168,11 +168,11 @@ stderr_logfile=/dev/stderr
|
|||
stderr_logfile_maxbytes = 0
|
||||
|
||||
[program:v1-functions]
|
||||
command=php /usr/share/nginx/html/vendor/bin/resque
|
||||
command=php /usr/src/code/vendor/bin/resque
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=10
|
||||
environment=QUEUE='v1-functions',APP_INCLUDE='/usr/share/nginx/html/app/workers/functions.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s'
|
||||
environment=QUEUE='v1-functions',APP_INCLUDE='/usr/src/code/app/workers/functions.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s'
|
||||
stdout_events_enabled=true
|
||||
stderr_events_enabled=true
|
||||
stopsignal=QUIT
|
||||
|
|
Loading…
Reference in a new issue