Skip to content

Commit d37097a

Browse files
authored
Merge pull request #40 from itk-event-database/feature/3136_archive_as_v1
Feature/3136 archive as v1
2 parents 4cbc5bc + 1f8b381 commit d37097a

26 files changed

+280
-109
lines changed

.docker/data/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore everything in this directory
2+
*
3+
# Except this file
4+
!.gitignore
5+
!Readme.md

.docker/data/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# .docker/data
2+
3+
Please map persistent volumes to this directory on the servers.
4+
5+
If a container needs to persist data between restarts you can map the relevant files in the container to ``docker/data/<container-name>`.
6+
7+
## RabbitMQ example
8+
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.
9+
10+
```yaml
11+
# docker-compose.server.override.yml
12+
13+
services:
14+
rabbit:
15+
image: rabbitmq:3.9-management-alpine
16+
hostname: "${COMPOSE_PROJECT_NAME}"
17+
networks:
18+
- app
19+
- frontend
20+
environment:
21+
- "RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}"
22+
- "RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}"
23+
- "RABBITMQ_ERLANG_COOKIE=${RABBITMQ_ERLANG_COOKIE}"
24+
volumes:
25+
- ".docker/data/rabbitmq:/var/lib/rabbitmq/mnesia/"
26+
```

.docker/nginx.conf

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
worker_processes auto;
22

3-
error_log /var/log/nginx/error.log notice;
3+
error_log /dev/stderr notice;
44
pid /tmp/nginx.pid;
55

66
events {
77
worker_connections 1024;
88
}
99

10-
1110
http {
1211
proxy_temp_path /tmp/proxy_temp;
1312
client_body_temp_path /tmp/client_temp;
@@ -18,19 +17,17 @@ http {
1817
include /etc/nginx/mime.types;
1918
default_type application/octet-stream;
2019

21-
set_real_ip_from 172.16.0.0/8;
20+
set_real_ip_from 172.16.0.0/16;
2221
real_ip_recursive on;
2322
real_ip_header X-Forwarded-For;
2423

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

29-
access_log /var/log/nginx/access.log main;
28+
access_log /dev/stdout main;
3029

3130
sendfile on;
32-
#tcp_nopush on;
33-
3431
keepalive_timeout 65;
3532

3633
gzip on;
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
server {
2+
listen ${NGINX_PORT};
3+
server_name localhost;
4+
5+
root ${NGINX_WEB_ROOT};
6+
7+
client_max_body_size ${NGINX_MAX_BODY_SIZE};
8+
9+
# This also needs to be set in the single server tag and not only in http.
10+
set_real_ip_from 172.16.0.0/16;
11+
real_ip_recursive on;
12+
real_ip_header X-Forwarded-For;
13+
14+
location / {
15+
# We are co-hosting with the legacy EventDB, so this app is hosted under '/v1'
16+
# This is configured for Symfony in 'framework.assets.base_path'. However
17+
# Symfony still installs assets in the root path so we need to rewrite the uri to remove '/v1'.
18+
rewrite ^/v1/bundles/(.*) /bundles/$1 break;
19+
20+
# try to serve file directly, fallback to index.php
21+
try_files $uri /app_dev.php$is_args$args;
22+
}
23+
24+
# Protect files and directories from prying eyes.
25+
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)$ {
26+
deny all;
27+
return 404;
28+
}
29+
30+
# Development
31+
location ~ ^/(app_dev|config)\.php(/|$) {
32+
fastcgi_buffers 16 32k;
33+
fastcgi_buffer_size 64k;
34+
fastcgi_busy_buffers_size 64k;
35+
36+
fastcgi_pass ${NGINX_FPM_SERVICE};
37+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
38+
include fastcgi_params;
39+
40+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
41+
fastcgi_param DOCUMENT_ROOT $realpath_root;
42+
}
43+
44+
# Production
45+
location ~ ^/app\.php(/|$) {
46+
fastcgi_pass ${NGINX_FPM_SERVICE};
47+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
48+
include fastcgi_params;
49+
50+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
51+
fastcgi_param DOCUMENT_ROOT $realpath_root;
52+
53+
internal;
54+
}
55+
56+
57+
location ~ \.php$ {
58+
return 404;
59+
}
60+
61+
# Send log message to files symlinked to stdout/stderr.
62+
error_log /dev/stderr;
63+
access_log /dev/stdout main;
64+
}

.docker/vhost.conf

-46
This file was deleted.

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Archived dec. 2024
2+
Project is archived and unmaintained. Please see:
3+
* https://github.com/itk-dev/event-database-imports
4+
* https://github.com/itk-dev/event-database-api
5+
16
Event database – the API
27
========================
38

app/config/config.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ framework:
3030
handler_id: ~
3131
fragments: ~
3232
http_method_override: true
33-
assets: ~
33+
assets:
34+
base_path: '/v1'
3435
property_info:
3536
enabled: true
3637

app/config/routing.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@ admin:
2323

2424
fos_user:
2525
resource: '@FOSUserBundle/Resources/config/routing/all.xml'
26+
prefix: /v1
2627

2728
fos_user_group:
2829
resource: '@FOSUserBundle/Resources/config/routing/group.xml'
29-
prefix: /group
30+
prefix: /v1/group
3031

3132
easy_admin_bundle:
3233
resource: '@AdminBundle/Controller/AdminController.php'
3334
type: annotation
34-
prefix: /easyadmin
35+
prefix: /v1/easyadmin
3536

3637
liip_imagine:
3738
resource: '@LiipImagineBundle/Resources/config/routing.yaml'
39+
prefix: /v1
3840

3941
terms_bundle:
4042
resource: '@ItkDevTermsBundle/Resources/config/routing.xml'
41-
prefix: /terms
43+
prefix: /v1/terms

app/config/routing_dev.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
_wdt:
22
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
3-
prefix: /_wdt
3+
prefix: /v1/_wdt
44

55
_profiler:
66
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
7-
prefix: /_profiler
7+
prefix: /v1/_profiler
88

99
_errors:
1010
resource: '@TwigBundle/Resources/config/routing/errors.xml'
11-
prefix: /_error
11+
prefix: /v1/_error
1212

1313
_main:
1414
resource: routing.yml

app/config/security.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,16 @@ security:
5858
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
5959
# form_login:
6060

61-
pattern: ^/
61+
pattern: ^/v1
6262
form_login:
6363
provider: fos_userbundle
6464
check_path: fos_user_security_check
6565
login_path: fos_user_security_login
66+
default_target_path: default
6667
# csrf_provider: security.csrf.token_manager
67-
logout: true
68+
logout:
69+
path: fos_user_security_logout
70+
target: default
6871
logout_on_user_change: true
6972

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

78-
- { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
79-
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
80-
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
81-
- { path: ^/admin, role: ROLE_USER }
82-
- { path: ^/easyadmin, role: ROLE_USER }
81+
- { path: ^/v1/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
82+
- { path: ^/v1/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
83+
- { path: ^/v1/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
84+
- { path: ^/v1/admin, role: ROLE_USER }
85+
- { path: ^/v1/easyadmin, role: ROLE_USER }

docker-compose.dev.yml

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
# itk-version: 3.0.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
services:
53
phpfpm:
64
environment:
7-
- PHP_SENDMAIL_PATH='/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"'
5+
- PHP_SENDMAIL_PATH=/usr/sbin/sendmail -S mail:1025
86

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

13-
mailhog:
14-
image: itkdev/mailhog
11+
mail:
12+
image: axllent/mailpit
13+
restart: unless-stopped
1514
networks:
1615
- app
1716
- frontend
1817
labels:
1918
- "traefik.enable=true"
2019
- "traefik.docker.network=frontend"
21-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
22-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
23-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
20+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
21+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
22+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
2423
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
25-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
26-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
27-
- "traefik.http.services.mailhog_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
28-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"
24+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
25+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
26+
- "traefik.http.services.mail_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
27+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"

docker-compose.override.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# itk-version: 3.2.1
2+
services:
3+
nginx:
4+
labels:
5+
# Scope hosting by path prefix to allow shared hosting with EventDB v2
6+
# 'https://api.detskeriaarhus.dk/v1/' -> Legacy EventDB (v1)
7+
# 'https://api.detskeriaarhus.dk/api/' -> Legacy EventDB API (v1)
8+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.rule=Host(`${COMPOSE_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"
9+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"

docker-compose.redirect.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.0.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
services:
53
nginx:
64
labels:

docker-compose.server.override.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# itk-version: 3.2.1
2+
services:
3+
nginx:
4+
labels:
5+
# Scope hosting by path prefix to allow shared hosting with EventDB v2
6+
# 'https://api.detskeriaarhus.dk/v1/' -> Legacy EventDB (v1)
7+
# 'https://api.detskeriaarhus.dk/api/' -> Legacy EventDB API (v1)
8+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}-http.rule=Host(`${COMPOSE_SERVER_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"
9+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_SERVER_DOMAIN}`) && (PathPrefix(`/v1`) || PathPrefix(`/api`))"

docker-compose.server.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.0.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
networks:
53
frontend:
64
external: true
@@ -31,12 +29,15 @@ services:
3129
- frontend
3230
depends_on:
3331
- phpfpm
34-
ports:
35-
- '8080'
3632
volumes:
37-
- ./.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
33+
- ./.docker/templates:/etc/nginx/templates:ro
3834
- ./.docker/nginx.conf:/etc/nginx/nginx.conf:ro
39-
- ./:/app:rw
35+
- .:/app
36+
environment:
37+
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
38+
NGINX_WEB_ROOT: /app/web
39+
NGINX_PORT: 8080
40+
NGINX_MAX_BODY_SIZE: 5M
4041
labels:
4142
- "traefik.enable=true"
4243
- "traefik.docker.network=frontend"

0 commit comments

Comments
 (0)