Table of Contents
init.sh.cfg
This is the main configuration file. Its variables will be used by the templates. You can define your own additional variables to use them in templates too.
❗It’s a MUST to change this file.
(1) It is a MUST to change
- APP_NAME - the name of your application/ project (lowercase and without spaces)
(2) You SHOULD change the portmappings in
- APP_PORT - exposed tcp port for apache httpd
(3) If you use mariadb then set this value to true:
- DB_ADD=true
Then the image for myriadb will be enabled in the generated docker compose file.
- DB_PORT - exposed tcp port for mariadb
(4) Check needed packages and modules in
- APP_APT_PACKAGES
- APP_APACHE_MODULES
- APP_PHP_MODULES
(5) You can change versions
- APP_PHP_VERSION
- MYSQL_IMAGE
Initial config
# ======================================================================
#
# 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>
# ======================================================================
APP_NAME=my_new_app
# web port 80 in container is seen on localhost as ...
APP_PORT=8001
APP_APT_PACKAGES="git unzip zip"
# headers is needed to set security headers.
# APP_APACHE_MODULES="headers rewrite"
APP_APACHE_MODULES="headers"
APP_PHP_VERSION=8.3
# APP_PHP_MODULES="curl pdo_mysql mbstring xml zip xdebug"
APP_PHP_MODULES="curl mbstring xml zip xdebug"
# optional exec command after container was started with init.sh script
# APP_ONSTARTUP="php /var/www/${APP_NAME}/public_html/myservice.php"
APP_ONSTARTUP=""
# ----------------------------------------------------------------------
# add a container with database?
DB_ADD=false
# ----------------------------------------------------------------------
# for an optional database server
DB_PORT=13306
# ----- database settings
MYSQL_IMAGE=mariadb:10.5.9
MYSQL_RANDOM_ROOT_PASSWORD=0
MYSQL_ALLOW_EMPTY_PASSWORD=0
MYSQL_ROOT_PASS=12345678
MYSQL_USER=${APP_NAME}
MYSQL_PASS=mypassword
MYSQL_DB=${APP_NAME}
# ======================================================================
# ignore things below
# where to set acl where local user and web user in container
# can write simultanously
WRITABLEDIR=../public_html
# web service user in container
DOCKER_USER_UID=33
# document root inside web-server container
WEBROOT=/var/www/${APP_NAME}/public_html
# path of web url to open
WEBURL=/
CUTTER_NO_DATABASE="CUT-HERE-FOR-NO-DATABASE"
# ----------------------------------------------------------------------
Description
In alphabetic order:
variable | type | description |
---|---|---|
APP_APACHE_MODULES | string | list of additional apache modules in apache container; separated with spaces |
APP_APT_PACKAGES | string | list of additional packages in apache container; example: “git unzip zip” |
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 see https://github.com/mlocati/docker-php-extension-installer for the list of supported modules example: “curl mbstring xml zip xdebug” |
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; 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. |
DC_SHOW_MENUHINTS | int | Flag to show a notice why menu items are visible; default: 0 (off) |
DOCKER_USER_UID | int | unix uid of the httpd service user in apache container; it’s not needed to change; default: 33 |
MYSQL_ALLOW_EMPTY_PASSWORD | int | flag: 0 |
MYSQL_DB | string | name of database; defaut is app name ${APP_NAME} |
MYSQL_IMAGE | string | image to use; default: mariadb:10.5.9 |
MYSQL_PASS | string | mypassword |
MYSQL_RANDOM_ROOT_PASSWORD | string | 0 |
MYSQL_ROOT_PASS | string | 12345678 |
MYSQL_USER | string | ${APP_NAME} |
WEBROOT | string | webroot directory inside apache container; default: /var/www/${APP_NAME}/public_html |
WEBURL | string | path of web url to open; default: / |
WRITABLEDIR | string | local webroot directory; default: ../public_html |