Skip to content

Commit 01c8b7a

Browse files
authored
Merge pull request #18 from aakb/feature/ITSTYR-78_cleanup
Feature/itstyr 78 cleanup
2 parents f21da53 + 07ca6c5 commit 01c8b7a

7 files changed

Lines changed: 89 additions & 75 deletions

File tree

.env.dist renamed to .env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# Copy this file to .env file for development, create environment variables when deploying to production
33
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
44

5+
###> aakb/itkdev-docker configuration ###
6+
COMPOSE_PROJECT_NAME=itstyr
7+
COMPOSE_DOMAIN=itstyr.local.itkdev.dk
8+
###< aakb/itkdev-docker configuration ###
9+
510
###> symfony/framework-bundle ###
611
APP_ENV=dev
712
APP_SECRET=ef328b855abd10c26ed43a768edcb8e7

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
###> symfony/framework-bundle ###
3-
/.env
43
/public/bundles/
54
/var/
65
/vendor/

README.md

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Styringsværktøj til IT projekter
33

44
## Setup locally
55

6-
Copy `.env.dist` to `.env`.
7-
86
### Start Docker containers
97

108
```sh
@@ -21,48 +19,12 @@ docker-compose exec phpfpm bin/console fos:user:create --super-admin
2119

2220
### Access the site
2321

24-
You can get the site url by running:
25-
26-
```sh
27-
echo http://itstyr.docker.localhost:$(docker-compose port reverse-proxy 80 | cut -d: -f2)
28-
```
29-
30-
Open it in your default browser by running:
31-
32-
```sh
33-
open http://itstyr.docker.localhost:$(docker-compose port reverse-proxy 80 | cut -d: -f2)
34-
```
35-
36-
Note: You may have to add the line
37-
38-
```
39-
0.0.0.0 itstyr.docker.localhost
40-
```
41-
42-
to your `hosts` file to access the site.
43-
44-
## Debugging
22+
You should now be able to browse to the application
4523

46-
To enable debugging in the `phpfpm` container, you have to restart it and enable `xdebug`:
47-
48-
```sh
49-
PHP_XDEBUG=1 \
50-
PHP_XDEBUG_REMOTE_AUTOSTART=1 \
51-
PHP_XDEBUG_REMOTE_HOST=$(ipconfig getifaddr en0) \
52-
PHP_XDEBUG_REMOTE_PORT=9000 \
53-
PHP_XDEBUG_REMOTE_CONNECT_BACK=0 \
54-
docker-compose up -d
5524
```
56-
57-
To disable `xdebug`, restart the container:
58-
59-
```sh
60-
docker-compose up -d
25+
open http://$(docker-compose port nginx 80)
6126
```
6227

63-
## Setup on server
64-
https://symfony.com/doc/current/setup/web_server_configuration.html
65-
6628
## Import systems and reports
6729
```sh
6830
bin/console itstyr:import:system PATH

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2+
"name": "aakb/itstyr",
3+
"description": "",
24
"type": "project",
35
"license": "proprietary",
46
"require": {
5-
"php": "^7.1.3",
7+
"php": "^7.4",
68
"ext-iconv": "*",
79
"doctrine/doctrine-migrations-bundle": "^1.3",
810
"easycorp/easyadmin-bundle": "^2.3",

config/packages/doctrine.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ doctrine:
3232
gedmo_loggable:
3333
type: annotation
3434
prefix: Gedmo\Loggable\Entity
35-
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
35+
dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Loggable/Entity"
3636
alias: GedmoLoggable # (optional) it will default to the name set for the mapping
3737
is_bundle: false

docker-compose.server.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: "3"
2+
3+
networks:
4+
frontend:
5+
external: true
6+
app:
7+
driver: bridge
8+
internal: true
9+
external: false
10+
11+
services:
12+
phpfpm:
13+
image: itkdev/php7.4-fpm:alpine
14+
restart: unless-stopped
15+
networks:
16+
- app
17+
environment:
18+
- PHP_MAX_EXECUTION_TIME=30
19+
- PHP_MEMORY_LIMIT=128M
20+
volumes:
21+
- .:/app:delegated
22+
- drush-cache:/root/.drush
23+
24+
nginx:
25+
image: nginx:stable-alpine
26+
restart: unless-stopped
27+
networks:
28+
- app
29+
- frontend
30+
depends_on:
31+
- phpfpm
32+
ports:
33+
- '80'
34+
volumes:
35+
- ${PWD}/.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
36+
- ./:/app:rw
37+
labels:
38+
- "traefik.enable=true"
39+
- "traefik.docker.network=frontend"
40+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_SERVER_DOMAIN}`)"
41+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
42+
#- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=ITKBasicAuth@file"
43+
44+
# Drush cache volume to persist cache between runs.
45+
volumes:
46+
drush-cache:

docker-compose.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
version: "3"
22

3+
networks:
4+
frontend:
5+
external: true
6+
app:
7+
driver: bridge
8+
internal: false
9+
310
services:
411
mariadb:
5-
image: mariadb:10.3
12+
image: itkdev/mariadb:latest
13+
networks:
14+
- app
615
ports:
716
- '3306'
817
environment:
9-
MYSQL_ROOT_PASSWORD: password
10-
MYSQL_USER: db
11-
MYSQL_PASSWORD: db
12-
MYSQL_DATABASE: db
13-
# @see https://symfony.com/doc/current/setup/symfony_server.html#docker-integration
14-
labels:
15-
com.symfony.server.service-prefix: 'DATABASE'
18+
- MYSQL_ROOT_PASSWORD=password
19+
- MYSQL_USER=db
20+
- MYSQL_PASSWORD=db
21+
- MYSQL_DATABASE=db
22+
#- ENCRYPT=1 # Uncomment to enable database encryption.
1623

1724
phpfpm:
1825
image: itkdev/php7.4-fpm:latest
19-
restart: always
26+
networks:
27+
- app
2028
environment:
21-
- PHP_XDEBUG=${PHP_XDEBUG:-0}
22-
- PHP_XDEBUG_REMOTE_AUTOSTART=${PHP_XDEBUG_REMOTE_AUTOSTART:-0}
23-
- PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST:-0.0.0.0}
24-
- PHP_XDEBUG_REMOTE_CONNECT_BACK=${PHP_XDEBUG_REMOTE_CONNECT_BACK:-0}
25-
# - PHP_MAIL=1 # Uncomment to enable mailhog
29+
- XDEBUG_MODE=${XDEBUG_MODE:-off}
30+
- XDEBUG_SESSION=${XDEBUG_SESSION:-0}
31+
- PHP_MAX_EXECUTION_TIME=30
32+
- PHP_MEMORY_LIMIT=256M
33+
# - PHP_MAIL=1 # Uncomment to enable mailhog.
34+
- DOCKER_HOST_DOMAIN=${COMPOSE_DOMAIN}
35+
- COMPOSER_VERSION=1
2636
depends_on:
2737
- mariadb
2838
volumes:
2939
- .:/app:delegated
3040

3141
nginx:
3242
image: nginx:latest
43+
networks:
44+
- app
45+
- frontend
3346
depends_on:
3447
- phpfpm
3548
ports:
@@ -38,27 +51,14 @@ services:
3851
- ${PWD}/.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
3952
- ./:/app:delegated
4053
labels:
41-
- "traefik.frontend.rule=Host:${COMPOSE_PROJECT_NAME}.docker.localhost"
42-
43-
memcached:
44-
image: 'memcached:latest'
45-
ports:
46-
- '11211'
47-
environment:
48-
- MEMCACHED_CACHE_SIZE=64
54+
- "traefik.enable=true"
55+
- "traefik.docker.network=frontend"
56+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_DOMAIN}`)"
4957

5058
mailhog:
5159
image: mailhog/mailhog
52-
restart: always
60+
networks:
61+
- app
5362
ports:
5463
- "1025"
5564
- "8025"
56-
57-
reverse-proxy:
58-
image: traefik # The official Traefik docker image
59-
command: --api --docker # Enables the web UI and tells Traefik to listen to docker
60-
ports:
61-
- "80"
62-
- "8080"
63-
volumes:
64-
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events

0 commit comments

Comments
 (0)