Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated project to work on new storm infrastructure #2

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:17-alpine3.12
FROM docker.io/node:17-alpine3.12

# Create app directory
WORKDIR /usr/src/app
Expand All @@ -8,8 +8,8 @@ COPY package.json ./
RUN npm install

# Add support for debugging
RUN npm install -g nodemon
EXPOSE 9229
# RUN npm install -g nodemon
# EXPOSE 9229

# Switch user
USER node
Expand Down
20 changes: 12 additions & 8 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ volumes:
services:
admin:
hostname: admin
image: filegator/filegator
image: docker.io/filegator/filegator:latest
restart: unless-stopped
user: root
environment:
- BASE_URL='/admin'
- APP_PUBLIC_PATH='/admin/'
TadMaj marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- media:/var/www/filegator/repository
# Persist configuration (credentials, etc.)
- /var/www/filegator/private

- ./configuration.php:/var/www/filegator/configuration.php
- ./filegator-entrypoint.sh:/var/www/filegator/entrypoint.sh
cmd: /var/www/filegator/entrypoint.sh
backend:
hostname: backend
restart: unless-stopped
Expand All @@ -23,8 +28,8 @@ services:
- media:/srv/media:ro
# Mount source code to restart without rebuilding image
# (TODO only for development)
- ./backend:/usr/src/app
- /usr/src/app/node_modules
#- ./backend:/usr/src/app
#- /usr/src/app/node_modules
build:
context: ./backend
environment:
Expand All @@ -37,10 +42,9 @@ services:
- backend
hostname: frontend
restart: unless-stopped
volumes:
# Mount source code to restart without rebuilding image
# (TODO only for development)
- ./frontend:/usr/src/app
#- ./frontend:/usr/src/app
build:
context: ./frontend

Expand All @@ -53,7 +57,7 @@ services:
hostname: reverse-proxy
restart: unless-stopped
ports:
- 8080:80
- 8005:80
build:
context: ./reverse-proxy

Expand Down
119 changes: 119 additions & 0 deletions configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?php

return [
'public_path' => '/admin/',
'public_dir' => APP_PUBLIC_DIR,
'overwrite_on_upload' => false,
'timezone' => 'UTC', // https://www.php.net/manual/en/timezones.php
'download_inline' => ['pdf'], // download inline in the browser, array of extensions, use * for all
'lockout_attempts' => 5, // max failed login attempts before ip lockout
'lockout_timeout' => 15, // ip lockout timeout in seconds

'frontend_config' => [
'app_name' => 'FileGator',
'app_version' => APP_VERSION,
'language' => 'english',
'logo' => 'https://filegator.io/filegator_logo.svg',
'upload_max_size' => 100 * 1024 * 1024, // 100MB
'upload_chunk_size' => 1 * 1024 * 1024, // 1MB
'upload_simultaneous' => 3,
'default_archive_name' => 'archive.zip',
'editable' => ['.txt', '.css', '.js', '.ts', '.html', '.php', '.json', '.md'],
'date_format' => 'YY/MM/DD hh:mm:ss', // see: https://momentjs.com/docs/#/displaying/format/
'guest_redirection' => '', // useful for external auth adapters
'search_simultaneous' => 5,
'filter_entries' => [],
],

'services' => [
'Filegator\Services\Logger\LoggerInterface' => [
'handler' => '\Filegator\Services\Logger\Adapters\MonoLogger',
'config' => [
'monolog_handlers' => [
function () {
return new \Monolog\Handler\StreamHandler(
__DIR__.'/private/logs/app.log',
\Monolog\Logger::DEBUG
);
},
],
],
],
'Filegator\Services\Session\SessionStorageInterface' => [
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
'config' => [
'handler' => function () {
$save_path = null; // use default system path
//$save_path = __DIR__.'/private/sessions';
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler($save_path);

return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([
"cookie_samesite" => "Lax",
"cookie_secure" => null,
"cookie_httponly" => true,
], $handler);
},
],
],
'Filegator\Services\Cors\Cors' => [
'handler' => '\Filegator\Services\Cors\Cors',
'config' => [
'enabled' => APP_ENV == 'production' ? false : true,
],
],
'Filegator\Services\Tmpfs\TmpfsInterface' => [
'handler' => '\Filegator\Services\Tmpfs\Adapters\Tmpfs',
'config' => [
'path' => __DIR__.'/private/tmp/',
'gc_probability_perc' => 10,
'gc_older_than' => 60 * 60 * 24 * 2, // 2 days
],
],
'Filegator\Services\Security\Security' => [
'handler' => '\Filegator\Services\Security\Security',
'config' => [
'csrf_protection' => true,
'csrf_key' => "123456", // randomize this
'ip_allowlist' => [],
'ip_denylist' => [],
'allow_insecure_overlays' => false,
],
],
'Filegator\Services\View\ViewInterface' => [
'handler' => '\Filegator\Services\View\Adapters\Vuejs',
'config' => [
'add_to_head' => '',
'add_to_body' => '',
],
],
'Filegator\Services\Storage\Filesystem' => [
'handler' => '\Filegator\Services\Storage\Filesystem',
'config' => [
'separator' => '/',
'config' => [],
'adapter' => function () {
return new \League\Flysystem\Adapter\Local(
__DIR__.'/repository'
);
},
],
],
'Filegator\Services\Archiver\ArchiverInterface' => [
'handler' => '\Filegator\Services\Archiver\Adapters\ZipArchiver',
'config' => [],
],
'Filegator\Services\Auth\AuthInterface' => [
'handler' => '\Filegator\Services\Auth\Adapters\JsonFile',
'config' => [
'file' => __DIR__.'/private/users.json',
],
],
'Filegator\Services\Router\Router' => [
'handler' => '\Filegator\Services\Router\Router',
'config' => [
'query_param' => 'r',
'routes_file' => __DIR__.'/backend/Controllers/routes.php',
],
],
],
];
5 changes: 5 additions & 0 deletions filegator-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

chown -R 33:33 /var/www/filegator/repository;
apache2-foreground

2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:stable-alpine
FROM docker.io/nginx:stable-alpine

# Create app directory
WORKDIR /usr/src/app
Expand Down
12 changes: 6 additions & 6 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ server {

# Disable all caching
# (only for development)
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
# add_header Last-Modified $date_gmt;
# add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
# if_modified_since off;
# expires off;
# etag off;
}
}
}
2 changes: 1 addition & 1 deletion reverse-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:stable-alpine
FROM docker.io/nginx:stable-alpine

# Apply custom nginx configuration
RUN rm /etc/nginx/conf.d/default.conf
Expand Down
5 changes: 4 additions & 1 deletion reverse-proxy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ server {

location /admin {
proxy_pass http://admin:8080/;
client_max_body_size 50M;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}

Loading