|
1 |
| -# nginx_ssl_keycloak_mysql_redis-docker |
2 |
| -Handy docker compose example file that sets up a nginx_ssl_keycloak_mysql_redis-docker |
| 1 | +# Nginx_ssl_keycloak_mysql_redis-docker |
| 2 | +Handy docker compose example file that sets up a nginx_ssl_keycloak_mysql_redis as a service ready to use. |
| 3 | +This compose file is based on serveral other repos and online articles. This repos works as an example of use only. |
| 4 | + |
| 5 | +## Pre-Requirements |
| 6 | +Knowledge about all elements in the compose file before use. |
| 7 | +> Nginx and Let’s Encrypt it taken from this repo. You can find more information here https://github.com/wmnnd/nginx-certbot. |
| 8 | +
|
| 9 | +> The `init-letsencrypt.sh` fetched from https://github.com/wmnnd/nginx-certbot has been slightly modefied in this example. |
| 10 | +> In this example you can add domains from comand line, like this: |
| 11 | + |
| 12 | + - `./init-letsencrypt.sh [staging | production] <domain1 domain2 ...> ` |
| 13 | + |
| 14 | +> Note: In this example The mariadb is build from compose file to use timezone Europe/Oslo. Remove if not needed. |
| 15 | +
|
| 16 | +## Handy styff |
| 17 | +This docker compose file sets up: |
| 18 | + |
| 19 | + - nginx with ssl sertificates |
| 20 | + - Inclues config app.conf file but to be used as example only. |
| 21 | + - based on some articles and repos |
| 22 | + https://github.com/wmnnd/nginx-certbot |
| 23 | + https://medium.com/@pentacent/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71 |
| 24 | + |
| 25 | + - Keycloak for authentication with custom "adminlte" login page |
| 26 | + - based on some articles: |
| 27 | + https://medium.com/@shivangbhandari/custom-themes-for-keycloak-631bdd3e04e5 |
| 28 | + https://www.mai1015.com/development/2019/05/05/docker-keycloak-proxy-behind-nginx/ |
| 29 | + https://www.keycloak.org/docs/4.8/authorization_services/ |
| 30 | + https://www.youtube.com/watch?v=XJYy6Aq-PJ8 |
| 31 | + - Example theme from: |
| 32 | + https://github.com/MAXIMUS-DeltaWare/adminlte-keycloak-theme |
| 33 | + |
| 34 | + - mysql with config |
| 35 | + - Inclues config my.cnf file but to be used as example only. Remember to change my.cnf gile dependent of what kind of mariadb version you use. |
| 36 | + |
| 37 | + - Redis |
| 38 | + |
| 39 | + |
| 40 | +## Run with ssl sertificates |
| 41 | +``` |
| 42 | +# Run the docker compose |
| 43 | +docker-compose up -d --build |
| 44 | +
|
| 45 | +# Init you sertificates |
| 46 | +# Depending on you user rights it could be that you have to give the user access to run the shell file. |
| 47 | +# Also use staging when testing or you will have to wait for a while between each run. |
| 48 | +# Example: chmod +x username:usergroup ./init-letsencrypt.sh |
| 49 | +./init-letsencrypt.sh [staging | production] <domain1 domain2 ...> |
| 50 | +
|
| 51 | +``` |
| 52 | + |
| 53 | +## Run without ssl sertificates ( local testing) |
| 54 | +``` |
| 55 | +# Run the docker compose |
| 56 | +docker-compose -f docker-compose-without-ssl.yml up -d --build |
| 57 | +``` |
| 58 | + |
| 59 | +## Test the stuff |
| 60 | +Examples below will help you test that stuff is running correctly. |
| 61 | + |
| 62 | +### Nginx test |
| 63 | +``` |
| 64 | +# go to your browser: |
| 65 | +# expected result: web site opens |
| 66 | +http://127.0.0.1:8180 |
| 67 | +``` |
| 68 | + |
| 69 | +### Keycloak test |
| 70 | +``` |
| 71 | +# go to your browser: |
| 72 | +# expected result: web site opens |
| 73 | +http://127.0.0.1:8180 |
| 74 | +``` |
| 75 | +Now, log in as admin and change the default theme for the one in this example: |
| 76 | +[](screenshots/keycloak_theme_example_01.png) [](screenshots/keycloak_theme_example_02.png) [](screenshots/screen3.png) |
| 77 | + |
| 78 | +### Monetdb test |
| 79 | +``` |
| 80 | +# In command line: |
| 81 | +# expected result: |
| 82 | +# +--------------------+ |
| 83 | +# | Database | |
| 84 | +# +--------------------+ |
| 85 | +# | information_schema | |
| 86 | +# | keycloak | |
| 87 | +# +--------------------+ |
| 88 | +docker exec -it mariadb mysql -ukeycloak -pkeycloak -e "SHOW DATABASES;" |
| 89 | +``` |
| 90 | + |
| 91 | +### Redis test |
| 92 | +``` |
| 93 | +# In command line: |
| 94 | +# expected result: < PONG |
| 95 | +docker exec -it redis redis-cli PING |
| 96 | +
|
| 97 | +``` |
0 commit comments