Skip to content

Commit 687a8d1

Browse files
Update docker images and documentation
1 parent f5add01 commit 687a8d1

20 files changed

+589
-169
lines changed

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Files
2+
.editorconfig
3+
.gitattributes
4+
.gitignore
5+
.gitlab-ci.yml
6+
.gitmodules
7+
.gtt.yml
8+
.php-cs-fixer.dist.php
9+
.env.local
10+
composer.phar
11+
rector.php
12+
tslint.json
13+
14+
# Folders
15+
.idea
16+
icinga
17+
node_modules
18+
public/build
19+
public/bundles
20+
systemd
21+
tests
22+
update
23+
var
24+
vendor

.env

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ SECRETS_FILE=%kernel.project_dir%/.secrets.json
3939

4040
# Exception mailer
4141
EXCEPTION_MAILER_URL=null://localhost
42-
EXCEPTION_RECEIVER=webmaster@drenso.nl
43-
EXCEPTION_SENDER=webmaster@ltb.itc.utwente.nl
42+
EXCEPTION_RECEIVER=
43+
EXCEPTION_SENDER=
4444

4545
# OpenID Connect
46-
OIDC_WELL_KNOWN=https://connect.surfconext.nl/.well-known/openid-configuration
47-
OIDC_CLIENT_ID=ltb.itc.utwente.nl
46+
OIDC_WELL_KNOWN=
47+
OIDC_CLIENT_ID=
4848

4949
# General settings
5050
PRODUCTION_SERVER=false
@@ -53,8 +53,8 @@ PANDOC_PATH=/usr/bin/pandoc
5353
PYTHON_PATH=/usr/bin/python3.8
5454

5555
# Domain settings
56-
HTTP_HOST=ltb.itc.utwente.nl
56+
HTTP_HOST=
5757
HTTP_SCHEMA=https
5858

5959
# Mailer settings
60-
MAIL_FROM="Living Textbook by ITC <noreply@ltb.itc.utwente.nl>"
60+
MAIL_FROM=

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,10 @@ yarn-error.log
4747

4848
# PHP-CS-Fixer cache
4949
.php-cs-fixer.cache
50+
51+
# Docker environment
52+
docker-compose.prod.yml
53+
docker/db.env
54+
docker/ltb_prod.env
55+
docker/nginx/server.key
56+
docker/nginx/server.cert

README.md

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,15 @@
1-
# Setup docker environment
1+
The Living Textbook project is developed and maintained by the [ITC faculty](https://www.itc.nl/) of
2+
the [University of Twente](https://utwente.nl).
23

3-
- `git clone`
4-
- `yarn install`
4+
> The documentation is currently a work in progress. More to come soon!
55
6-
Configure the relevant environment by creating the following files:
6+
Check our documentation in the `docs` folder!
77

8-
```
9-
# .env.local
10-
APP_ENV=dev
11-
DATABASE_URL=mysql://013-living-textbook:%database_password%@db:3306/013-living-textbook
12-
HTTP_HOST=localhost
13-
```
8+
- [Backend development](docs/backend-development.md)
9+
- [Frontend development](docs/frontend-development.md)
10+
- [Docker](docs/docker.md)
11+
- [Environment](docs/environment.md)
1412

15-
Place the following in `.secrets.json`
16-
```
17-
{
18-
"app": "SomeSecret",
19-
"database": "dbpass",
20-
"oidc": ""
21-
}
22-
```
13+
## Known issues
2314

24-
Create a self-signed certificate for nginx:
25-
26-
```
27-
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout docker/nginx/server.key -out docker/nginx/server.cert
28-
```
29-
30-
Build the docker containers with `docker-compose build`.
31-
32-
Bring it all up with `docker-compose up -d`.
33-
34-
Open a console within the php container (assuming the folder is `013-living-textbook`):
35-
36-
- `docker exec -it 013-living-textbook_php_1 /bin/sh`
37-
- `composer install`
38-
- `bin/console doctrine:migrations:migrate` and select `y`
39-
40-
In your normal console, now run:
41-
42-
- `yarn build`
43-
44-
Execute the following queries in the console of the db container (in `docker exec -it 013-living-textbook_db_1 /bin.sh` -> `mysql`)
45-
46-
```sql
47-
use 013-living-textbook;
48-
INSERT INTO user__table (given_name, last_name, full_name, display_name, username, is_oidc, is_admin, roles, password, registered_on, created_at, created_by) VALUES ('Dev', 'Loper', 'Developer', 'Developer', 'developer@localhost.nl', 0, 1, 'a:0:{}', '$argon2id$v=19$m=65536,t=4,p=1$0HoR4yJvi6fb5xFtXXH66w$yXO7fsj/I1X7/jFb0NuNuN/AkRBsiJOLmAnezAFWwCM', NOW(), NOW(), 'developer');
49-
INSERT INTO study_area (owner_user_id, name, created_at, access_type, track_users, open_access, analytics_dashboard_enabled, review_mode_enabled, dotron) VALUES (1, 'Development Area', NOW(), 'public', 0, 0, 0, 0, 0);
50-
```
51-
52-
Open the ltb on `https://localhost:10443/` (and ignore the certificate error). You can login with a local account
53-
used `developer@localhost.nl`:`developer` as credentials. This is a full admin account.
54-
55-
OIDC login will not work, as localhost is not configured (or can be configured as) as valid return URL.
56-
57-
# JS development
58-
59-
You should be able to start the JS development server
60-
with `yarn encore dev-server --hot --https --disableHostCheck=true --cert docker/nginx/server.cert --key docker/nginx/server.key`
61-
for HMR, or just use `yarn watch` when HMR is not required.
15+
The python data visualisation module is not (yet) publicly available, meaning those endpoints will fail when used.

docker-compose.dev.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
version: '3.4'
2+
3+
services:
4+
ltb:
5+
build:
6+
context: .
7+
target: ltb_dev
8+
dockerfile: docker/ltb/Dockerfile
9+
restart: always
10+
volumes:
11+
- './:/usr/src/app/'
12+
environment:
13+
APP_ENV: dev
14+
PYTHON_PATH: '/usr/local/bin/python3.8'
15+
DATABASE_CHECK: 'db:3306'
16+
DATABASE_URL: 'mysql://ltb:%database_password%@db:3306/ltb'
17+
PRODUCTION_SERVER: 'false'
18+
TRUSTED_PROXIES: 10.9.8.1
19+
HTTP_HOST: localhost
20+
depends_on:
21+
- db
22+
networks:
23+
- ltb-network
24+
25+
nginx:
26+
image: nginx:1.21.6-alpine
27+
restart: always
28+
volumes:
29+
- './public:/usr/src/app:ro'
30+
- './docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro'
31+
- './docker/nginx/server.cert:/etc/nginx/certs/server.cert:ro'
32+
- './docker/nginx/server.key:/etc/nginx/certs/server.key:ro'
33+
depends_on:
34+
- ltb
35+
ports:
36+
- '10443:443'
37+
networks:
38+
- ltb-network
39+
40+
db:
41+
image: mariadb:10.8.2
42+
command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci' ]
43+
restart: always
44+
environment:
45+
MYSQL_USER: ltb
46+
MYSQL_DATABASE: ltb
47+
env_file:
48+
- docker/db.env
49+
volumes:
50+
- 'ltb-database:/var/lib/mysql'
51+
networks:
52+
- ltb-network
53+
54+
volumes:
55+
ltb-database:
56+
ltb-uploads:
57+
ltb-public:
58+
59+
networks:
60+
ltb-network:
61+
driver: bridge
62+
ipam:
63+
config:
64+
- subnet: 10.9.8.0/24

docker-compose.prod.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
version: '3.4'
2+
3+
services:
4+
ltb:
5+
build:
6+
context: .
7+
target: ltb_prod
8+
dockerfile: docker/ltb/Dockerfile
9+
restart: always
10+
volumes:
11+
- 'ltb-uploads:/usr/src/app/public/uploads'
12+
- 'ltb-public:/usr/src/app/public_mirror'
13+
- './.secrets.json:/usr/src/app/.secrets.json:ro'
14+
environment:
15+
PYTHON_PATH: '/usr/local/bin/python3.8'
16+
DATABASE_CHECK: 'db:3306'
17+
DATABASE_URL: 'mysql://ltb:%database_password%@db:3306/ltb'
18+
PRODUCTION_SERVER: 'true'
19+
TRUSTED_PROXIES: 10.9.8.1
20+
env_file:
21+
- docker/ltb_prod.env
22+
depends_on:
23+
- db
24+
networks:
25+
- ltb-network
26+
27+
nginx:
28+
image: nginx:1.21.6-alpine
29+
restart: always
30+
volumes:
31+
- 'ltb-public:/usr/src/app:ro'
32+
- './docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro'
33+
- './docker/nginx/server.cert:/etc/nginx/certs/server.cert:ro'
34+
- './docker/nginx/server.key:/etc/nginx/certs/server.key:ro'
35+
depends_on:
36+
- ltb
37+
ports:
38+
- '10443:443'
39+
networks:
40+
- ltb-network
41+
42+
db:
43+
image: mariadb:10.8.2
44+
command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci' ]
45+
restart: always
46+
environment:
47+
MYSQL_USER: ltb
48+
MYSQL_DATABASE: ltb
49+
env_file:
50+
- docker/db.env
51+
volumes:
52+
- 'ltb-database:/var/lib/mysql'
53+
networks:
54+
- ltb-network
55+
56+
volumes:
57+
ltb-database:
58+
ltb-uploads:
59+
ltb-public:
60+
61+
networks:
62+
ltb-network:
63+
driver: bridge
64+
ipam:
65+
config:
66+
- subnet: 10.9.8.0/24

docker-compose.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

docker/db.env.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MYSQL_ROOT_PASSWORD=
2+
MYSQL_PASSWORD=

0 commit comments

Comments
 (0)