Skip to content

Feature/3136 archive as v1 #40

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

Merged
merged 6 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .docker/data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
!Readme.md
26 changes: 26 additions & 0 deletions .docker/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .docker/data

Please map persistent volumes to this directory on the servers.

If a container needs to persist data between restarts you can map the relevant files in the container to ``docker/data/<container-name>`.

## RabbitMQ example
If you are using RabbitMQ running in a container as a message broker you need to configure a persistent volume for RabbitMQs data directory to avoid losing message on container restarts.

```yaml
# docker-compose.server.override.yml

services:
rabbit:
image: rabbitmq:3.9-management-alpine
hostname: "${COMPOSE_PROJECT_NAME}"
networks:
- app
- frontend
environment:
- "RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}"
- "RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}"
- "RABBITMQ_ERLANG_COOKIE=${RABBITMQ_ERLANG_COOKIE}"
volumes:
- ".docker/data/rabbitmq:/var/lib/rabbitmq/mnesia/"
```
9 changes: 3 additions & 6 deletions .docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
worker_processes auto;

error_log /var/log/nginx/error.log notice;
error_log /dev/stderr notice;
pid /tmp/nginx.pid;

events {
worker_connections 1024;
}


http {
proxy_temp_path /tmp/proxy_temp;
client_body_temp_path /tmp/client_temp;
Expand All @@ -18,19 +17,17 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

set_real_ip_from 172.16.0.0/8;
set_real_ip_from 172.16.0.0/16;
real_ip_recursive on;
real_ip_header X-Forwarded-For;

log_format main '$http_x_real_ip - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
access_log /dev/stdout main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

gzip on;
Expand Down
64 changes: 64 additions & 0 deletions .docker/templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
server {
listen ${NGINX_PORT};
server_name localhost;

root ${NGINX_WEB_ROOT};

client_max_body_size ${NGINX_MAX_BODY_SIZE};

# This also needs to be set in the single server tag and not only in http.
set_real_ip_from 172.16.0.0/16;
real_ip_recursive on;
real_ip_header X-Forwarded-For;

location / {
# We are co-hosting with the legacy EventDB, so this app is hosted under '/v1'
# This is configured for Symfony in 'framework.assets.base_path'. However
# Symfony still installs assets in the root path so we need to rewrite the uri to remove '/v1'.
rewrite ^/v1/bundles/(.*) /bundles/$1 break;

# try to serve file directly, fallback to index.php
try_files $uri /app_dev.php$is_args$args;
}

# Protect files and directories from prying eyes.
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|.tar|.gz|.bz2|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
deny all;
return 404;
}

# Development
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;

fastcgi_pass ${NGINX_FPM_SERVICE};
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}

# Production
location ~ ^/app\.php(/|$) {
fastcgi_pass ${NGINX_FPM_SERVICE};
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;

internal;
}


location ~ \.php$ {
return 404;
}

# Send log message to files symlinked to stdout/stderr.
error_log /dev/stderr;
access_log /dev/stdout main;
}
46 changes: 0 additions & 46 deletions .docker/vhost.conf

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Archived dec. 2024
Project is archived and unmaintained. Please see:
* https://github.com/itk-dev/event-database-imports
* https://github.com/itk-dev/event-database-api

Event database – the API
========================

Expand Down
3 changes: 2 additions & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ framework:
handler_id: ~
fragments: ~
http_method_override: true
assets: ~
assets:
base_path: '/v1'
property_info:
enabled: true

Expand Down
8 changes: 5 additions & 3 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ admin:

fos_user:
resource: '@FOSUserBundle/Resources/config/routing/all.xml'
prefix: /v1

fos_user_group:
resource: '@FOSUserBundle/Resources/config/routing/group.xml'
prefix: /group
prefix: /v1/group

easy_admin_bundle:
resource: '@AdminBundle/Controller/AdminController.php'
type: annotation
prefix: /easyadmin
prefix: /v1/easyadmin

liip_imagine:
resource: '@LiipImagineBundle/Resources/config/routing.yaml'
prefix: /v1

terms_bundle:
resource: '@ItkDevTermsBundle/Resources/config/routing.xml'
prefix: /terms
prefix: /v1/terms
6 changes: 3 additions & 3 deletions app/config/routing_dev.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
prefix: /v1/_wdt

_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler
prefix: /v1/_profiler

_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
prefix: /v1/_error

_main:
resource: routing.yml
17 changes: 10 additions & 7 deletions app/config/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ security:
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
# form_login:

pattern: ^/
pattern: ^/v1
form_login:
provider: fos_userbundle
check_path: fos_user_security_check
login_path: fos_user_security_login
default_target_path: default
# csrf_provider: security.csrf.token_manager
logout: true
logout:
path: fos_user_security_logout
target: default
logout_on_user_change: true

access_control:
Expand All @@ -75,8 +78,8 @@ security:
# Read only API access
- { path: ^/api, roles: [IS_AUTHENTICATED_ANONYMOUSLY] }

- { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, role: ROLE_USER }
- { path: ^/easyadmin, role: ROLE_USER }
- { path: ^/v1/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/v1/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/v1/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/v1/admin, role: ROLE_USER }
- { path: ^/v1/easyadmin, role: ROLE_USER }
25 changes: 12 additions & 13 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# itk-version: 3.0.0
version: "3"

# itk-version: 3.2.1
services:
phpfpm:
environment:
- PHP_SENDMAIL_PATH='/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"'
- PHP_SENDMAIL_PATH=/usr/sbin/sendmail -S mail:1025

nginx:
labels:
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=ITKBasicAuth@file"

mailhog:
image: itkdev/mailhog
mail:
image: axllent/mailpit
restart: unless-stopped
networks:
- app
- frontend
labels:
- "traefik.enable=true"
- "traefik.docker.network=frontend"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
- "traefik.http.services.mailhog_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
- "traefik.http.services.mail_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"
9 changes: 9 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# itk-version: 3.2.1
services:
nginx:
labels:
# Scope hosting by path prefix to allow shared hosting with EventDB v2
# 'https://api.detskeriaarhus.dk/v1/' -> Legacy EventDB (v1)
# 'https://api.detskeriaarhus.dk/api/' -> Legacy EventDB API (v1)
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.rule=Host(`${COMPOSE_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"
4 changes: 1 addition & 3 deletions docker-compose.redirect.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# itk-version: 3.0.0
version: "3"

# itk-version: 3.2.1
services:
nginx:
labels:
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.server.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# itk-version: 3.2.1
services:
nginx:
labels:
# Scope hosting by path prefix to allow shared hosting with EventDB v2
# 'https://api.detskeriaarhus.dk/v1/' -> Legacy EventDB (v1)
# 'https://api.detskeriaarhus.dk/api/' -> Legacy EventDB API (v1)
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.rule=Host(`${COMPOSE_SERVER_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_SERVER_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"
15 changes: 8 additions & 7 deletions docker-compose.server.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# itk-version: 3.0.0
version: "3"

# itk-version: 3.2.1
networks:
frontend:
external: true
Expand Down Expand Up @@ -31,12 +29,15 @@ services:
- frontend
depends_on:
- phpfpm
ports:
- '8080'
volumes:
- ./.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
- ./.docker/templates:/etc/nginx/templates:ro
- ./.docker/nginx.conf:/etc/nginx/nginx.conf:ro
- ./:/app:rw
- .:/app
environment:
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
NGINX_WEB_ROOT: /app/web
NGINX_PORT: 8080
NGINX_MAX_BODY_SIZE: 5M
labels:
- "traefik.enable=true"
- "traefik.docker.network=frontend"
Expand Down
Loading
Loading