Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ff87be3
Adjusted scaffold settings in composer.json file
andriyun Mar 1, 2021
cfb48e3
Added description for development environment
andriyun Mar 2, 2021
0179cba
Adding an updated install procedure.
Mar 2, 2021
822d965
This documentation includes the installation procedure, which works a…
Mar 2, 2021
9757334
Fixed mistakes.
Mar 2, 2021
1e2a681
Added full path to settings.php file.
Mar 2, 2021
a1b7d57
Restructure and additions per input from ITK.
Mar 3, 2021
7ce097b
Merge pull request #10 from OS2Forms/master
andriyun Mar 3, 2021
4703127
Adding install description for traditional development environment
lats1 Mar 3, 2021
f832d96
Updated hash content-hash in composer.lock file so its in sync wiht c…
lats1 Mar 3, 2021
cc36205
Merge pull request #11 from OS2Forms/feature/update-composer-lock
andriyun Mar 3, 2021
1deba68
Merge pull request #8 from OS2Forms/#41790_documentation_additions
madsnorgaard Mar 4, 2021
e2c5f63
Merge branch 'develop' into docker
andriyun Mar 5, 2021
f8ba7fd
Merge branch 'develop' into docker
andriyun Mar 5, 2021
4a98a10
Changed configuration for docker based environment for PRODUCTION. Fr…
andriyun Mar 5, 2021
8ddeed2
Merge branch 'master' into develop
andriyun Mar 8, 2021
0573474
Changed configuration for docker based environment for PRODUCTION. Fr…
andriyun Mar 5, 2021
267624f
Merge branch 'docker' of github.com:OS2Forms/os2forms8 into docker
andriyun Mar 8, 2021
fb6867e
Added readiness probe file. Used in kubernetes environments.
andriyun Mar 8, 2021
65221de
Added updating baseimage command before building image
andriyun Mar 8, 2021
2e6c741
Fixed permissions on logs folder
andriyun Mar 18, 2021
8979bf6
Added extra debug into into health-check file
andriyun Mar 19, 2021
f0a7c04
Adjusted trusted hosts env variable to let healt-checkfile be called …
andriyun Mar 19, 2021
d8e3273
Switched os2fors image building to branch
andriyun Mar 19, 2021
7d80846
Redirected all PHP error output info docker console
andriyun Mar 23, 2021
c4cbf6c
Removed old docker-compose stack files
andriyun Mar 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
553 changes: 0 additions & 553 deletions .docker/apache/conf/httpd.conf

This file was deleted.

39 changes: 0 additions & 39 deletions .docker/apache/example.com.conf.template

This file was deleted.

62 changes: 62 additions & 0 deletions .docker/os2forms/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
FROM drupal:8-apache-buster

# Installing additional dependencies.
RUN set -eux; \
apt update; \
apt install -qq -y \
libxml2-dev \
libldap2-dev \
git \
wget \
zip \
mariadb-client-10.3 \
cron; \
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
docker-php-ext-install soap ldap

# Removing standard Drupal core and loading OS2Web project.
WORKDIR /opt
# Getting recent state of master branch.
ARG OS2FORMS8_TAG
RUN set -eux; \
rm -rf drupal; \
# PRODUCTION SETTINGS
# Loading OS2Forms via tags.
# wget https://github.com/os2forms/os2forms8/archive/$OS2FORMS8_TAG.tar.gz; \
# tar -xzvf $OS2FORMS8_TAG.tar.gz; \
# rm $OS2FORMS8_TAG.tar.gz; \
# mv os2forms8-$OS2FORMS8_TAG drupal
# DEVELOPMENT SETTINGS
# Loading OS2Forms from branch to avoid development releases.
wget https://github.com/OS2Forms/os2forms8/archive/docker.zip; \
unzip docker.zip; \
rm docker.zip; \
mv os2forms8-docker drupal
WORKDIR /opt/drupal

# Loading composer dependencies and configuring project folders.
RUN set -eux; \
composer self-update --1; \
export COMPOSER_HOME="$(mktemp -d)"; \
composer global require hirak/prestissimo;\
COMPOSER_MEMORY_LIMIT=-1 composer install; \
chown -R www-data:www-data web/sites web/modules web/themes; \
# delete composer cache.
rm -rf "$COMPOSER_HOME"

# Adding further site specific data to image.
RUN mkdir -p files; \
mkdir -p private; \
mkdir -p config/sync; \
mkdir -p tmp; \
rm -rf /opt/drupal/web/sites/default/files; \
ln -sf /opt/drupal/files /opt/drupal/web/sites/default/files; \
# Adjusting ownership
chown -R www-data:www-data /opt/drupal/private /opt/drupal/files /opt/drupal/config/sync /opt/drupal/tmp /opt/drupal/logs; \
chmod g+s -R /opt/drupal/private /opt/drupal/files /opt/drupal/config/sync

# Adding custom apache configuration with PHP value and log settings.
COPY apache/000-default.conf /etc/apache2/sites-enabled/000-default.conf

# Adding Drupal settings.
COPY drupal/settings.local.php /opt/drupal/web/sites/default/
37 changes: 37 additions & 0 deletions .docker/os2forms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# OS2Forms8 docker image

Purpose of this image to run OS2Forms8 project in dockerized environment.

Image based on official [Drupal image](https://hub.docker.com/_/drupal)

Image includes all functional project files inside (PHP code, Composer dependencies).

Drupal content files should be attached as [Volumes](https://docs.docker.com/storage/volumes/) to container:
* public files - `/opt/drupal/files`
* private files - `/opt/drupal/private`

## Environment settings

There are available following environment settings:

### Mysql database
* MYSQL_HOSTNAME - mysql service host name
* MYSQL_DATABASE - mysql service database name
* MYSQL_PORT - mysql service port
* MYSQL_USER - mysql service user
* MYSQL_PASSWORD - mysql service password

### Drupal
* DRUPAL_HASH_SALT - define drupal hash salt. Uses in `settings.php` file

## Build image

To build image use `build.sh` script with git tag of OS2Forms8 project release as first argument.
NOTE: You should have existing tag for OS2Web project before.

Example:
```
./build.sh [tag-name] --push
```

`--push` - when you this option build will be pushed to docker hub.
30 changes: 30 additions & 0 deletions .docker/os2forms/apache/000-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<VirtualHost *:80>
# There is no host restriction here.
# Restriction should be implemented on upper levels.
#ServerName example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# SimpleSAMLphp settings
SetEnv SIMPLESAMLPHP_CONFIG_DIR /opt/drupal/simplesamlphp/config
Alias /simplesaml /opt/drupal/vendor/simplesamlphp/simplesamlphp/www
<Directory /opt/drupal/vendor/simplesamlphp/simplesamlphp/www>
Require all granted
</Directory>


# PHP Custom settings
php_admin_value open_basedir /opt/drupal:/usr/share/php
php_value include_path .:/opt/drupal
php_value log_errors 1
php_value html_errors 0
php_value display_errors 0
php_admin_value error_reporting 1023
php_value error_log /dev/stderr
php_value session.save_path /opt/drupal/sessions
php_admin_value upload_max_filesize 150
php_admin_value upload_tmp_dir /opt/drupal/tmp
</VirtualHost>
32 changes: 32 additions & 0 deletions .docker/os2forms/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

if [ $# -eq 0 ]; then
echo "WARNING: There was no tag-name provided!"
echo "Script usage is: './build.sh tag-name'"
echo "Example: './build.sh 1.0.3'"
exit 0
fi

echo "Updating base image"
docker image pull drupal:8-apache-buster

echo "Building OS2Forms image with tag $1"
docker build ./ --build-arg OS2FORMS8_TAG=$1 -t os2forms/os2forms8:$1

if [ "$2" = "--push" ]; then
echo "Authorization to https://hub.docker.com. :"
echo "Login:"
read -s DOCKERHUB_LOGIN
echo "Password:"
read -s DOCKERHUB_PASS
echo "Authorization..."
echo $DOCKERHUB_PASS | docker login --username $DOCKERHUB_LOGIN --password-stdin

if [ $? -eq 0 ]; then
echo "Pushing image to docker hub ..."
docker push os2forms/os2forms8:$1
echo "Check your image here https://hub.docker.com/repository/docker/os2forms/os2forms8"
else
echo "Image is not pushed to docker hub :("
fi;
fi;
19 changes: 19 additions & 0 deletions .docker/os2forms/drupal/settings.local.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

$databases['default']['default'] = [
'database' => getenv('MYSQL_DATABASE'),
'driver' => 'mysql',
'host' => getenv('MYSQL_HOSTNAME'),
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'password' => getenv('MYSQL_PASSWORD'),
'port' => getenv('MYSQL_PORT'),
'prefix' => '',
'username' => getenv('MYSQL_USER'),
];

$settings['hash_salt'] = getenv('DRUPAL_HASH_SALT');
$settings['trusted_host_patterns'] = empty(getenv('DRUPAL_TRUSTED_HOST')) ? NULL : ['^'.getenv('DRUPAL_TRUSTED_HOST').'$'];

$settings['config_sync_directory'] = '../config/sync';
$settings['file_temp_path'] = '../tmp';
$settings['file_private_path'] = '../private';
File renamed without changes.
48 changes: 0 additions & 48 deletions .docker/php/Dockerfile

This file was deleted.

31 changes: 0 additions & 31 deletions .docker/php/custom.ini

This file was deleted.

24 changes: 14 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
# ];
#
# Uncomment and populate as needed.
# APP_ENV=dev
# DATA_PATH_HOST=~/.docker/data
# MYSQL_ROOT_PASSWORD=5up3r_57r0nk_p455w0rd
# MYSQL_DATABASE=lorge_database
# MYSQL_USER=database_user
# MYSQL_PASSWORD=5up3r_53cr37_p455w0rd
# COMPOSE_PROJECT_NAME=os2forms
#
# Another common use case is to set Drush's --uri via environment.
# DRUSH_OPTIONS_URI=http://example.com
# MYSQL_ROOT_PASSWORD=
# MYSQL_DATABASE=
# MYSQL_HOSTNAME=
# MYSQL_USER=
# MYSQL_PASSWORD=
# MYSQL_PORT=
# DRUPAL_HASH_SALT=
# DRUPAL_TRUSTED_HOST=

# OS2Forms8 image tag. See https://hub.docker.com/repository/docker/os2forms/os2forms8
# OS2FORMS8_TAG=

# Port that is used on host machine for reaching out application
# WEB_SERVER_PORT=80
21 changes: 17 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@
/web/sites/*/settings.php
/web/sites/*/settings.local.php

# Ignore Drupal's file directory
# Ignore config files. It's not supposed to use configuration management flow.
/config/

# Ignore Drupal's file directory and other project sensitive information.
/web/sites/*/files/
logs/*
!logs/.gitkeep
tmp/*
!tmp/.gitkeep
files/*
!files/.gitkeep
private/*
!private/.gitkeep
simplesamlphp/*
!simplesamlphp/README.md
!simplesamlphp/config/.gitkeep

# Ignore SimpleTest multi-site environment.
/web/sites/simpletest
Expand All @@ -28,9 +42,8 @@
!/.docksal/commands/rebuild-test

# docker stuff
logs/*.log
.docker/logs/*.log
.docker/php/logs/*.log
.docker/mariadb/data
.docker/apache/logs/*.log
.docker/apache/conf/sites-enabled/*.conf
/.csslintrc
Expand All @@ -45,4 +58,4 @@ logs/*.log
/index.php
/robots.txt
/update.php
/web.config
/web.config
Loading