1
0
Fork 0
mirror of synced 2024-05-20 20:52:36 +12:00

Added volumes constants

This commit is contained in:
Eldad Fux 2020-02-19 14:41:23 +02:00
parent 7faedecbe4
commit fe5d9107c0
9 changed files with 22 additions and 14 deletions

View file

@ -28,7 +28,6 @@ $services = include __DIR__.'/config/services.php'; // List of services
$webhook = new Event('v1-webhooks', 'WebhooksV1');
$audit = new Event('v1-audits', 'AuditsV1');
$usage = new Event('v1-usage', 'UsageV1');
$certs = new Event('v1-certs', 'CertsV1');
/**
* Get All verified client URLs for both console and current projects

View file

@ -49,7 +49,7 @@ $avatarCallback = function ($type, $code, $width, $height, $quality) use ($types
throw new Exception('File not readable in '.$path, 500);
}
$cache = new Cache(new Filesystem('/storage/cache/app-0')); // Limit file number or size
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE.'/app-0')); // Limit file number or size
$data = $cache->load($key, 60 * 60 * 24 * 30 * 3 /* 3 months */);
if ($data) {
@ -146,7 +146,7 @@ $utopia->get('/v1/avatars/image')
$date = date('D, d M Y H:i:s', time() + (60 * 60 * 24 * 45)).' GMT'; // 45 days cache
$key = md5('/v2/avatars/images-'.$url.'-'.$width.'/'.$height.'/'.$quality);
$type = 'png';
$cache = new Cache(new Filesystem('/storage/cache/app-0')); // Limit file number or size
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE.'/app-0')); // Limit file number or size
$data = $cache->load($key, 60 * 60 * 24 * 7 /* 1 week */);
if ($data) {
@ -214,7 +214,7 @@ $utopia->get('/v1/avatars/favicon')
$date = date('D, d M Y H:i:s', time() + (60 * 60 * 24 * 45)).' GMT'; // 45 days cache
$key = md5('/v2/avatars/favicon-'.$url);
$type = 'png';
$cache = new Cache(new Filesystem('/storage/cache/app-0')); // Limit file number or size
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE.'/app-0')); // Limit file number or size
$data = $cache->load($key, 60 * 60 * 24 * 30 * 3 /* 3 months */);
if ($data) {

View file

@ -119,7 +119,7 @@ $utopia->get('/v1/health/storage/local')
->label('docs', false)
->action(
function () use ($response) {
$device = new Local('/storage/uploads/');
$device = new Local(APP_STORAGE_UPLOADS.'/');
if (!is_readable($device->getRoot().'/..')) {
throw new Exception('Device is not readable');

View file

@ -25,7 +25,7 @@ use OpenSSL\OpenSSL;
include_once __DIR__ . '/../shared/api.php';
Storage::addDevice('local', new Local('/storage/uploads/app-'.$project->getId()));
Storage::addDevice('local', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId()));
$fileLogos = [ // Based on this list @see http://stackoverflow.com/a/4212908/2299554
'default' => 'default.gif',
@ -357,7 +357,7 @@ $utopia->get('/v1/storage/files/:fileId/preview')
throw new Exception('File not found in '.$path, 404);
}
$cache = new Cache(new Filesystem('/storage/cache/app-'.$project->getId())); // Limit file number or size
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE.'/app-'.$project->getId())); // Limit file number or size
$data = $cache->load($key, 60 * 60 * 24 * 30 * 3 /* 3 months */);
if ($data) {

View file

@ -321,7 +321,7 @@ $utopia->get('/v1/mock/tests/general/oauth2/failure')
$utopia->shutdown(function() use ($response, $request, &$result, $utopia) {
$route = $utopia->match($request);
$path = '/storage/cache/tests.json';
$path = APP_STORAGE_CACHE.'/tests.json';
$tests = (file_exists($path)) ? json_decode(file_get_contents($path), true) : [];
if(!is_array($tests)) {

View file

@ -26,6 +26,9 @@ const APP_USERAGENT = APP_NAME.'-Server/%s Please report abuse at '.APP_EMAIL_SE
const APP_MODE_ADMIN = 'admin';
const APP_PAGING_LIMIT = 15;
const APP_VERSION_STABLE = '0.5.0';
const APP_STORAGE_UPLOADS = '/storage/uploads';
const APP_STORAGE_CACHE = '/storage/cache';
const APP_STORAGE_CERTIFICATES = '/storage/certificates';
$register = new Registry();
$request = new Request();

View file

@ -2,9 +2,9 @@
require_once __DIR__.'/../init.php';
cli_set_process_title('Certs V1 Worker');
cli_set_process_title('Certificates V1 Worker');
echo APP_NAME.' certs worker v1 has started';
echo APP_NAME.' certificates worker v1 has started';
class CertsV1
{
@ -18,17 +18,23 @@ class CertsV1
{
global $register;
$domain = $this->args['domain'];
/**
* 1. Get new domain
* 2. Fetch all subdomains
* 3. Check if certificate already exists
* 4. Check if certificate has been changed
* 4.1. Create / Renew certificate
* 4.1. Create / renew certificate
* 4.2. Update loadblancer
* 4.3. Update certificate (domains, change date, expiry)
*/
$response = shell_exec("certbot certonly --webroot --noninteractive --agree-tos --email security@appwrite.io \
-w ./certs \
-d {$domain}"); // cert2.tests.appwrite.org
}
public function tearDown()

View file

@ -108,12 +108,12 @@ startretries=10
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes = 0
[program:v1-certs]
[program:v1-certificates]
command=php /usr/share/nginx/html/vendor/bin/resque
autostart=true
autorestart=true
priority=10
environment=QUEUE='v1-certs',APP_INCLUDE='/usr/share/nginx/html/app/workers/certs.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s'
environment=QUEUE='v1-certificates',APP_INCLUDE='/usr/share/nginx/html/app/workers/certificates.php',REDIS_BACKEND='%(ENV__APP_REDIS_HOST)s:%(ENV__APP_REDIS_PORT)s'
stdout_events_enabled=true
stderr_events_enabled=true
stopsignal=QUIT

View file

@ -27,7 +27,7 @@ class S3 extends Device
*/
public function getRoot()
{
return '/storage/uploads';
return '';
}
/**