1
0
Fork 0
mirror of synced 2024-05-10 07:42:34 +12:00

Added a new volume

This commit is contained in:
Eldad Fux 2020-07-15 00:20:46 +03:00
parent 436300439d
commit 8d5e62a02b
14 changed files with 32 additions and 17 deletions

4
.gitignore vendored
View file

@ -1,10 +1,6 @@
/.vscode/
/vendor/
/node_modules/
/storage/uploads/
/storage/cache
/storage/db
/storage/influxdb
/tests/resources/storage/
/.idea/
.DS_Store

View file

@ -129,11 +129,13 @@ RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \
mkdir -p /storage/config && \
mkdir -p /storage/certificates && \
mkdir -p /storage/functions && \
mkdir -p /storage/debug && \
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions && \
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
# Executables

View file

@ -129,11 +129,13 @@ RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \
mkdir -p /storage/config && \
mkdir -p /storage/certificates && \
mkdir -p /storage/functions && \
mkdir -p /storage/debug && \
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions && \
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
# Executables

View file

@ -159,10 +159,12 @@ RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \
mkdir -p /storage/config && \
mkdir -p /storage/certificates && \
mkdir -p /storage/functions && \
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions
# Supervisord Conf
COPY ./docker/supervisord.conf /etc/supervisord.conf

View file

@ -129,11 +129,13 @@ RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \
mkdir -p /storage/config && \
mkdir -p /storage/certificates && \
mkdir -p /storage/functions && \
mkdir -p /storage/debug && \
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions && \
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
# Executables

View file

@ -102,7 +102,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN \
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests webp certbot htop procps \
apt-get install -y --no-install-recommends --no-install-suggests webp certbot htop procps docker.io \
libonig-dev libcurl4-gnutls-dev libmagickwand-dev libyaml-dev libbrotli-dev libz-dev && \
pecl install imagick yaml && \
docker-php-ext-enable imagick yaml
@ -129,11 +129,13 @@ RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \
mkdir -p /storage/config && \
mkdir -p /storage/certificates && \
mkdir -p /storage/functions && \
mkdir -p /storage/debug && \
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions && \
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
# Executables
@ -172,4 +174,4 @@ EXPOSE 80
#, "-dxdebug.profiler_enable=1"
#, "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php"
CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]
CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]

View file

@ -89,7 +89,8 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo
: '.'.$request->getHostname()
);
Storage::setDevice('local', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId()));
Storage::setDevice('files', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId()));
Storage::setDevice('functions', new Local(APP_STORAGE_FUNCTIONS.'/app-'.$project->getId()));
/*
* Security Headers

View file

@ -230,7 +230,7 @@ App::post('/v1/functions/:functionId/tags')
}
$file = $request->getFiles('code');
$device = Storage::getDevice('local');
$device = Storage::getDevice('functions');
$fileType = new FileType([FileType::FILE_TYPE_GZIP]);
$fileSize = new FileSize(App::getEnv('_APP_STORAGE_LIMIT', 0));
$upload = new Upload();

View file

@ -261,7 +261,7 @@ App::get('/v1/health/stats') // Currently only used internally
/** @var Utopia\Response $response */
/** @var Utopia\Registry\Registry $register */
$device = Storage::getDevice('local');
$device = Storage::getDevice('files');
$cache = $register->get('cache');
$cacheStats = $cache->info();

View file

@ -75,7 +75,7 @@ App::post('/v1/storage/files')
throw new Exception('File size not allowed', 400);
}
$device = Storage::getDevice('local');
$device = Storage::getDevice('files');
if (!$upload->isValid($file['tmp_name'])) {
throw new Exception('Invalid file', 403);
@ -239,7 +239,7 @@ App::get('/v1/storage/files/:fileId/preview')
/** @var Appwrite\Database\Document $project */
/** @var Appwrite\Database\Database $projectDB */
$storage = 'local';
$storage = 'files';
if (!\extension_loaded('imagick')) {
throw new Exception('Imagick extension is missing', 500);
@ -282,7 +282,7 @@ App::get('/v1/storage/files/:fileId/preview')
}
$compressor = new GZIP();
$device = Storage::getDevice('local');
$device = Storage::getDevice('files');
if (!\file_exists($path)) {
throw new Exception('File not found', 404);
@ -371,7 +371,7 @@ App::get('/v1/storage/files/:fileId/download')
}
$compressor = new GZIP();
$device = Storage::getDevice('local');
$device = Storage::getDevice('files');
$source = $device->read($path);
@ -428,7 +428,7 @@ App::get('/v1/storage/files/:fileId/view')
}
$compressor = new GZIP();
$device = Storage::getDevice('local');
$device = Storage::getDevice('files');
$contentType = 'text/plain';
@ -542,7 +542,7 @@ App::delete('/v1/storage/files/:fileId')
throw new Exception('File not found', 404);
}
$device = Storage::getDevice('local');
$device = Storage::getDevice('files');
if ($device->delete($file->getAttribute('path', ''))) {
if (!$projectDB->deleteDocument($fileId)) {
@ -575,7 +575,7 @@ App::delete('/v1/storage/files/:fileId')
// ->label('sdk.method', 'getFileScan')
// ->label('sdk.hide', true)
// ->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
// ->param('storage', 'local', function () { return new WhiteList(['local']);})
// ->param('storage', 'files', function () { return new WhiteList(['files']);})
// ->action(
// function ($fileId, $storage) use ($response, $request, $projectDB) {
// $file = $projectDB->getDocument($fileId);

View file

@ -39,6 +39,7 @@ const APP_PAGING_LIMIT = 15;
const APP_CACHE_BUSTER = 125;
const APP_VERSION_STABLE = '0.6.2';
const APP_STORAGE_UPLOADS = '/storage/uploads';
const APP_STORAGE_FUNCTIONS = '/storage/functions';
const APP_STORAGE_CACHE = '/storage/cache';
const APP_STORAGE_CERTIFICATES = '/storage/certificates';
const APP_STORAGE_CONFIG = '/storage/config';

View file

@ -47,6 +47,7 @@ services:
- appwrite-cache:/storage/cache:rw
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
- appwrite-functions:/storage/functions:rw
- ./phpunit.xml:/usr/src/code/phpunit.xml
- ./tests:/usr/src/code/tests
- ./app:/usr/src/code/app
@ -208,6 +209,7 @@ volumes:
appwrite-cache:
appwrite-uploads:
appwrite-certificates:
appwrite-functions:
appwrite-influxdb:
appwrite-chronograf:
appwrite-config:

View file

@ -45,10 +45,12 @@ services:
- traefik.http.routers.appwrite-secure.rule=PathPrefix(`/`)
- traefik.http.routers.appwrite-secure.tls=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- appwrite-uploads:/storage/uploads:rw
- appwrite-cache:/storage/cache:rw
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
- appwrite-functions:/storage/functions:rw
- ./phpunit.xml:/usr/src/code/phpunit.xml
- ./tests:/usr/src/code/tests
- ./app:/usr/src/code/app
@ -371,6 +373,7 @@ volumes:
appwrite-cache:
appwrite-uploads:
appwrite-certificates:
appwrite-functions:
appwrite-influxdb:
appwrite-chronograf:
appwrite-config:

View file

@ -50,6 +50,7 @@ services:
- appwrite-cache:/storage/cache:rw
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
- appwrite-functions:/storage/functions:rw
- ./phpunit.xml:/usr/src/code/phpunit.xml
- ./tests:/usr/src/code/tests
- ./app:/usr/src/code/app
@ -372,6 +373,7 @@ volumes:
appwrite-cache:
appwrite-uploads:
appwrite-certificates:
appwrite-functions:
appwrite-influxdb:
appwrite-chronograf:
appwrite-config: