Skip to content
Snippets Groups Projects
Commit af307dfc authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'replace_docker-compose' into 'master'

Replace docker compose

See merge request !7
parents 71e48790 b29e596c
No related branches found
No related tags found
1 merge request!7Replace docker compose
......@@ -2,7 +2,9 @@
#
# settings for init.sh and base values for replacements in template files
# This script is sourced by init.sh ... this file is bash syntax
#
#
# DOCS: https://os-docs.iml.unibe.ch/docker-php-starterkit/Configuration/init.sh.cfg.html
#
# ----------------------------------------------------------------------
# 2021-12-17 <axel.hahn@iml.unibe.ch>
# ======================================================================
......@@ -14,10 +16,11 @@ APP_PORT=8001
APP_APT_PACKAGES="git unzip zip"
#APP_APACHE_MODULES="rewrite"
APP_APACHE_MODULES=""
# headers is needed to set security headers.
# APP_APACHE_MODULES="headers rewrite"
APP_APACHE_MODULES="headers"
APP_PHP_VERSION=8.1
APP_PHP_VERSION=8.2
# APP_PHP_MODULES="curl pdo_mysql mbstring xml zip xdebug"
APP_PHP_MODULES="curl mbstring xml zip xdebug"
......
......@@ -5,3 +5,5 @@
* in the first line must be a line `# TARGET: [name of target file]` to define the target file
* Placeholdrs have the syntax variable in double brackets, i.e. `{{VARNAME}}`
* variables to be replaced are those in docker/init.sh.cfg and `{{genrator}}`
see <https://os-docs.iml.unibe.ch/docker-php-starterkit/Configuration/Templates.html>
......@@ -15,4 +15,16 @@
Require all denied
</Location>
# security headers
Header unset X-Powered-By
Header set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
Header set Feature-Policy "sync-xhr 'self'"
Header set Referrer-Policy "strict-origin-when-cross-origin"
</VirtualHost>
\ No newline at end of file
# What problem does it solve?
I have a few php based projects with or without a database.
As a newbie in docker I installed a rootless docker.
And to dockerfy exsiting projects quick and dirty. Sure copy & paste works, but if you have multiple configuration files where variables must match then variables are very helpful. So here is a stupid simple template generator.
The init script:
* sets permisssions for container and local user
* generates needed files for docker from configuration and a set of templates
* starts/ stops your container
# What problems does it not solve?
It is a script for a dual container and Apache + PHP and Mariadb only. Nothing else.
## Requirements ##
* Bash (tested on Linux only)
It was tested on Linux only.
* Bash + GNU cure utilities
* Docker Non-root installation - see <https://docs.docker.com/engine/security/rootless/>
* ACL to enable write permissions on web data for Apache httpd in the container container and local user (you)
\ No newline at end of file
......@@ -56,10 +56,10 @@ The initial file structure looks like this:
### First start ###
* start init script in the docker folder: ```./docker/init.sh```
* use "g" to remove git data of the starterkit
* use "i" for init ... it sets an ACL on the ./public_html/ subdir to allow write access for your current user and the apache user in the docker container
* use "t" to generate config files from templates with the settings from ./docker/init.sh.cfg
* use "u" to bring up the container (OR run ```docker-compose up -d``` )
* use `g` to remove git data of the starterkit
* use `i` for init ... it sets an ACL on the ./public_html/ subdir to allow write access for your current user and the apache user in the docker container
* use `t` to generate config files from templates with the settings from ./docker/init.sh.cfg
* use `u` to bring up the container (OR run ```docker-compose up -d``` )
### Edit files ###
......
......@@ -108,8 +108,8 @@ APP_APT_PACKAGES | string | list of additional packages in apache c
APP_NAME | string | a uniq application name. It will be used as prefix for containers, network and other places. It is a MUST to change it in every new project.
APP_ONSTARTUP | string | optional command to execut if the apache container is up ""
APP_PHP_MODULES | string | list of additional php modules in apache container; separated with spaces<br>see <https://github.com/mlocati/docker-php-extension-installer> for the list of supported modules<br>example: "curl mbstring xml zip xdebug"
APP_PHP_VERSION | string | PHP version in apache container; example: 8.1
APP_PORT | int | port number for your local machine that will be maped to port 80 in the container; Change it if you run multiple projects in parallel; example: 8001
APP_PHP_VERSION | string | PHP version in apache container; example: 8.2
APP_PORT | int | port number for your local machine that will be maped to port 80 in the container; Change it if you run multiple projects in parallel; example: 8001;<br>Hint: set one port per application. Coordinate within in your dev team what port to use for what application
CUTTER_NO_DATABASE | const | do not change it; the string is used to cut templates from there if no database is used
DB_ADD | bool | flag: do you add a Mariadb container? default: false
DB_PORT | int | port number for your local machine that will be mapped to port 3306 in the container; You can use it in a local db manager; remark: tha apache container needs 3306 and not the mapped port.
......
......@@ -164,7 +164,8 @@ Apache vhost configuration for your app.
**It's a MUST to change this file.**
Setup modules and the vhost including rewrites , ...
Setup your vhost config files.
For the security headers in the buttom part the apache module "headers" ist needed.
```txt
# TARGET: docker/containers/web-server/apache/sites-enabled/vhost_app.conf
......@@ -184,6 +185,18 @@ Setup modules and the vhost including rewrites , ...
Require all denied
</Location>
# security headers
Header unset X-Powered-By
Header set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
Header set Feature-Policy "sync-xhr 'self'"
Header set Referrer-Policy "strict-origin-when-cross-origin"
</VirtualHost>
```
......
<html>
<div class="hero">
<h2>Configuration</h2>
</div>
</html>
<html>
<div class="hero">
<h2>Docker starter kit</h2>
This template folder brings up a docker container with a PHP 8.x dev environment with<br>
Apache httpd2 + mod_php.<br>
It can add an optionally 2nd container with a Mariadb instance.
</div>
</html>
# Docker starter kit #
Free software and Open Source from University of Bern :: IML - Institute of Medical Education
......@@ -9,16 +17,6 @@ Free software and Open Source from University of Bern :: IML - Institute of Medi
- - -
## About this template ##
This template folder brings up a docker container with a PHP 8.x dev environment with Apache httpd2 + mod_php.
It can add an optionally 2nd container with a Mariadb instance.
## Screenshot ##
![Main menu](images/main_menu.png)
The init script
* sets permisssions for container and local user
* generates needed files for docker from configuration and a set of templates
* starts/ stops your container
docs/images/main_menu.png

80.9 KiB | W: | H:

docs/images/main_menu.png

338 KiB | W: | H:

docs/images/main_menu.png
docs/images/main_menu.png
docs/images/main_menu.png
docs/images/main_menu.png
  • 2-up
  • Swipe
  • Onion skin
/*
override css elements of daux.io blue theme
version 2023-10-09
version 2023-11-10
*/
:root {
/* Axels Overrides */
--color-text: #234;
--link-color: #822;
--link-color: #228;
--brand-color: var(--color-text);
--brand-background: var(--body-background);
--code-tag-border-color: #d8d8d8;
--hr-color: none;
--search-field-background: none;
--search-field-border-color: none;
......@@ -46,9 +47,10 @@
.dark {
/* Axels Overrides */
--color-text: #c0c0c0;
--link-color: #c66;
--link-color: #88e;
--brand-color: var(--color-text);
--brand-background: var(--body-background);
--body-background: #101418;
--hr-color: none;
--code-tag-background-color_: #bcc;
--search-field-background: none;
......@@ -175,10 +177,12 @@ img{
.s-content .TableOfContentsContainer h4 {
margin: 1em 0;
font-size: 100%;
font-size: 110%;
text-align: center;
background-color: rgba(0, 0, 0, 0.05);
background-color: rgba(0, 0, 0, 0.1);
padding: 0.3em;
font-weight: bold;
font-family: Arial;
}
ul.TableOfContents a{
color: var(--color-text);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment