Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#36: Fixed problem with port 80 #37

Merged
merged 1 commit into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ testing environments for ILIAS. It will create and provision a docker container
according to your requirements, pull the ILIAS version you want to use and even
install it if possible.

## Setup
## Installation

1. download and unpack the [latest release](https://github.com/conceptsandtraining/ilias-tool-doil/releases)
1. download and unpack the [latest release](https://github.com/conceptsandtraining/doil/releases)
1. execute `sudo ./install.sh` in order to install **doil**
1. you can remove the downloaded folder afterwards
1. check `doil help` for available commands and further instructions

## Update

If you alread installed **doil** you can easily update with following steps:

1. download and unpack the [latest release](https://github.com/conceptsandtraining/doil/releases)
1. execute `sudo ./update.sh` in order to update **doil**
1. you can remove the downloaded folder afterwards

## Dependencies

**doil** tries to use as little 3rd party software on the host system as possible.
Expand Down Expand Up @@ -136,3 +144,12 @@ users, so make sure to understand what you are doing.
* `doil salt:update` updates the saltstack if you are using a custom saltstack
* `doil salt:login` logs the user into the main salt server
* `doil salt:prune` prunes the main salt server

## Changelog

### 1.0.1

* Fixed a bug in linux templates where the port 80 is blocked so no machine
could be started
* Added update script
* Changed readme (thanks @Rillke)
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# ,' | / ;'
# (,,/ (,,/ Thanks to Concepts and Training for supporting doil
#
# Last revised 2021-02-08
# Last revised 2021-03-23

# sudo user check
if [ "$EUID" -ne 0 ]
Expand Down
14 changes: 10 additions & 4 deletions src/lib/instances/create/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,16 @@ echo "[${NOW}] Copying necessary files"

# docker stuff
cp "/usr/local/lib/doil/tpl/minion/run-supervisor.sh" "${FOLDERPATH}/conf/run-supervisor.sh"
cp "/usr/local/lib/doil/tpl/minion/docker-compose.yml" "${FOLDERPATH}/docker-compose.yml"
cp "/usr/local/lib/doil/tpl/minion/Dockerfile" "${FOLDERPATH}/Dockerfile"
cp "/usr/local/lib/doil/tpl/stack/config/minion.cnf" "${FOLDERPATH}/conf/minion.cnf"
cp "/usr/local/lib/doil/tpl/minion/salt-minion.conf" "${FOLDERPATH}/conf/salt-minion.conf"
if [[ ${HOST} == 'linux' ]]
then
cp "/usr/local/lib/doil/tpl/minion/docker-compose.yml" "${FOLDERPATH}/docker-compose.yml"
elif [[ ${HOST} == 'mac' ]]
then
cp "/usr/local/lib/doil/tpl/minion/docker-compose-mac.yml" "${FOLDERPATH}/docker-compose.yml"
fi

# setting up config file
touch "${FOLDERPATH}/conf/doil.conf"
Expand Down Expand Up @@ -254,7 +260,7 @@ fi
until [[ ! -z ${DCMAINSALTSERVICE} ]]
do
echo "Master service not ready ..."
sleep 0.1
doil salt:restart
done
echo "Master service ready."

Expand Down Expand Up @@ -301,14 +307,14 @@ fi
# check if the new key is registered
SALTKEYS=$(docker exec -t -i ${DCMAINHASH} /bin/bash -c "salt-key -L" | grep "${NAME}.local")

if [ ! -z ${SALTKEYS} ]
if [[ ! -z ${SALTKEYS} ]]
then
echo "Key not ready yet"
sleep 5

SALTKEYS=$(docker exec -t -i ${DCMAINHASH} /bin/bash -c "salt-key -L" | grep "${NAME}.local")

if [ ! -z ${SALTKEYS} ]
if [[ ! -z ${SALTKEYS} ]]
then
echo "Key not ready yet"
sleep 5
Expand Down
36 changes: 36 additions & 0 deletions src/tpl/minion/docker-compose-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: "3.5"
services:
%TPL_PROJECT_NAME%:
build:
context: .
dockerfile: Dockerfile
image: doil/%TPL_PROJECT_NAME%:stable
container_name: %TPL_PROJECT_NAME%
hostname: %TPL_PROJECT_NAME%
domainname: local
ports:
- "80:80"
volumes:
- ./volumes/ilias:/var/www/html
- ./volumes/data:/var/ilias/data
- ./volumes/db/:/var/lib/mysql
- ./volumes/index:/var/ilias/index
- ./volumes/logs:/var/ilias/logs
- ./volumes/logs/error/:/var/ilias/logs/error
- ./volumes/logs/apache:/var/log/apache2
- ./conf/minion.cnf:/etc/salt/minion
- type: bind
source: ./conf/salt-minion.conf
target: /etc/supervisor/conf.d/salt-minion.conf
environment:
- ILIAS_INI_PATH=/var/www/html/ilias.ini.php
- TZ=Europe/Berlin
- JAVA_SERVER_PATH=/var/www/html/Services/WebServices/RPC/lib
- JAVA_SERVER_START
networks:
- main_saltnet
networks:
main_saltnet:
external: true
volumes:
persistent:
2 changes: 0 additions & 2 deletions src/tpl/minion/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ services:
container_name: %TPL_PROJECT_NAME%
hostname: %TPL_PROJECT_NAME%
domainname: local
ports:
- "80:80"
volumes:
- ./volumes/ilias:/var/www/html
- ./volumes/data:/var/ilias/data
Expand Down
135 changes: 135 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash

# doil is a tool that creates and manages multiple docker container
# with ILIAS and comes with several tools to help manage everything.
# It is able to download ILIAS and other ILIAS related software
# like cate.
#
# Copyright (C) 2020 - 2021 Laura Herzog ([email protected])
# Permission to copy and modify is granted under the AGPL license
#
# Contribute: https://github.com/conceptsandtraining/ilias-tool-doil
#
# .-.
# / /
# / |
# |\ ._ ,-"" `.
# | |,,_/ 7 ;
# `;= ,=( , /
# |`q q ` | \_,|
# .=; <> _ ; / ,/'/ |
# ';|\,j_ \;=\ ,/ `-'
# `--'_|\ )
# ,' | / ;'
# (,,/ (,,/ Thanks to Concepts and Training for supporting doil
#
# Last revised 2021-03-23

# sudo user check
if [ "$EUID" -ne 0 ]
then
echo -e "\033[1mREQUIREMENT ERROR:\033[0m"
echo -e "\tPlease execute this script as sudo user!"
exit
fi

CHECK_DOCKER=$(docker --version | tail -n 1 | cut -d " " -f 3 | cut -c 1-5)
vercomp () {
if [[ $1 == $2 ]]
then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++))
do
if [[ -z ${ver2[i]} ]]
then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]}))
then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]}))
then
return 2
fi
done
return 0
}

testvercomp () {
vercomp $1 $2
case $? in
0) op='=';;
1) op='>';;
2) op='<';;
esac
if [[ $op != $3 ]]
then
echo -e "\033[1mREQUIREMENT ERROR:\033[0m"
echo -e "\tYour docker version is not supported!"
echo -e "\tdoil requires at least docker version \033[1m19.03\033[0m. You have \033[1m${CHECK_DOCKER}\033[0m installed."
exit
fi
}
testvercomp ${CHECK_DOCKER} "19.02" ">"

# check the OS
OPS=""
case "$(uname -s)" in
Darwin)
OPS="mac"
;;
Linux)
OPS="linux"
;;
*)
echo -e "\033[1mREQUIREMENT ERROR:\033[0m"
echo -e "\tYour operating system is not supported!"
exit
;;
esac

################################
# Removing old version if needed
NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Removing old version"

if [ -f "/usr/local/bin/doil" ]
then
rm /usr/local/bin/doil
fi
if [ -d "/usr/local/lib/doil" ]
then
rm -rf /usr/local/lib/doil/lib
fi

#########################
# Copying the doil system
NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Copying the doil system"

# Move the base script to the /usr/local/bin folder and make it executeable
cp src/doil.sh /usr/local/bin/doil
chmod a+x /usr/local/bin/doil

# Move the script library to /usr/local/lib/doil
if [ ! -d "/usr/local/lib/doil" ]
then
mkdir /usr/local/lib/doil
fi
cp -r src/lib /usr/local/lib/doil/lib
chmod -R a+x /usr/local/lib/doil/lib

#################
# Everything done
NOW=$(date +'%d.%m.%Y %I:%M:%S')
echo "[${NOW}] Everything done"