Updated inital install

root 2021-09-29 13:07:52 +02:00
parent 2a9a84abc5
commit f0e4b55201
5 changed files with 116 additions and 69 deletions

View File

@ -71,6 +71,12 @@ cp -R custom.sample custom
Edita i substitueix els fitxers per personalitzar el sistema. Edita i substitueix els fitxers per personalitzar el sistema.
La primera vegada executa:
```
./dd-ctl update-repo
```
I després:
``` ```
./dd-ctl all ./dd-ctl all
``` ```
@ -134,11 +140,22 @@ Copieu digitaldemocratic.conf.exemple a digitaldemocratic.conf i editeu-lo per
Copia recursivament la carpeta *custom.sample* a *custom* i edita els fitxers yaml de personalització i menú i substitueix les imatges. Copia recursivament la carpeta *custom.sample* a *custom* i edita els fitxers yaml de personalització i menú i substitueix les imatges.
### Iniciar el projecte ### Iniciar el projecte
La primera vegada (i si voleu actualitzar a la última versió posteriorment) executeu:
```
./dd-ctl update-repo
```
I després
``` ```
./dd-ctl all ./dd-ctl all
``` ```
Posteriorment podreu iniciar o aturar amb:
```
./dd-ctl down
./dd-ctl up
```
### Integració ### Integració
Llegiu el fitxer [SAML_README.md](https://gitlab.com/isard/isard-sso/-/blob/master/docs/SAML_README.md) a la carpeta isard-sso/docs per integrar totes les aplicacions. Ara el Nextcloud i el Wordpress s'haurien d'integrar automàticament amb el Keycloak després d'acabar el *make all* excepte Moodle que encara necessita alguns passos manuals i el Wordpress que cal només activar el connector. Llegiu el fitxer [SAML_README.md](https://gitlab.com/isard/isard-sso/-/blob/master/docs/SAML_README.md) a la carpeta isard-sso/docs per integrar totes les aplicacions. Ara el Nextcloud i el Wordpress s'haurien d'integrar automàticament amb el Keycloak.

View File

@ -71,6 +71,11 @@ cp -R custom.sample custom
Edit and replace files to personalize system. Edit and replace files to personalize system.
The first time execute:
```
./dd-ctl update-repo
```
And then:
``` ```
./dd-ctl all ./dd-ctl all
``` ```
@ -111,14 +116,15 @@ Refer to the official documentation (https://docs.docker.com/engine/install/) or
Refer to the official documentation (https://docs.docker.com/compose/install/) or use our sysadm script if you are on a Debian Buster (10). Refer to the official documentation (https://docs.docker.com/compose/install/) or use our sysadm script if you are on a Debian Buster (10).
### Configuració ### Setup
Copieu digitaldemocratic.conf.sample a digitaldemocratic.conf i editeu-lo per satisfer les vostres necessitats. Com a mínim (per a desenvolupament) heu d'adaptar la variable de DOMINI al vostre domini arrel. Copy digitaldemocratic.conf.sample to digitaldemocratic.conf and edit to satisfy your needs. At least (to development) you should adapt
the DOMINI envvar to your root domain.
- PRODUCCIÓ: Necessiteu un dns multidomini (o redirigeix els subdominis múltiples) a la vostra màquina servidor. - PRODUCTION: You'll need a multidomain dns (or redirect all the subdomains) to your server IP.
- Desenvolupament: Heu d'editar el fitxer /etc/hosts i afegir els subdominis només per a propòsits de proves local. - DEVELOPMENT: You'll have to edit your /etc/hosts and add all the required domains to your development server IP.
#### Subdominis #### Subdomains
- Keycloak: sso.<yourdomain.org> - Keycloak: sso.<yourdomain.org>
- Api: api.<yourdomain.org> - Api: api.<yourdomain.org>
- Moodle: moodle.<yourdomain.org> - Moodle: moodle.<yourdomain.org>
@ -126,18 +132,32 @@ Copieu digitaldemocratic.conf.sample a digitaldemocratic.conf i editeu-lo per s
- Wordpress: wp.<yourdomain.org> - Wordpress: wp.<yourdomain.org>
- Onlyoffice: oof.<yourdomain.org> - Onlyoffice: oof.<yourdomain.org>
- Etherpad: pad.<yourdomain.org> - Etherpad: pad.<yourdomain.org>
- (opcional) FreeIPA: ipa.<yourdomain.org> - (optional) FreeIPA: ipa.<yourdomain.org>
### Personalització ### Customization
Copia recursivament la carpeta *custom.sample* a *custom* i edita els fitxers yaml de personalització i de menú i substitueix les imatges. Recursively copy the *custom.sampl* folder to *custom* and edit the yaml personalization files and substitute the image.
### Inicial el projecte ### Start the project
The first time (and to upgrade later) you should execute:
```
./dd-ctl update-repo
```
And after:
``` ```
./dd-ctl all ./dd-ctl all
``` ```
### Integració Then you can control the up/down:
```
./dd-ctl down
./dd-ctl up
```
Llegiu el [SAML_README.md](https://gitlab.com/isard/isard-sso/-/blob/master/docs/SAML_README.md) a la carpeta isard-sso/docs per integrar totes les aplicacions. Ara el nextcloud i el wordpress s'haurien d'integrar automàticament amb el Keycloak després d'acabar el *make all* excepte Moodle que encara necessita alguns passos manuals. i el plugin de Wordpress que cal només activar-lo en acabar. ### Integration
Read the [SAML_README.md](https://gitlab.com/isard/isard-sso/-/blob/master/docs/SAML_README.md) in isard-sso/docs folder
to known more about setting and customizing applications, specially if the SSO fails to get correctly configured the
first time.

112
dd-ctl
View File

@ -8,8 +8,9 @@ if [ -z "$OPERATION" ]; then
set +x set +x
echo "Missing command." echo "Missing command."
echo " Example: ./dd.ctl [operation]" echo " Example: ./dd.ctl [operation]"
echo " Bring the project up: ./dd-ctl all" echo " Update repository: ./dd-ctl update-repo [branch-name] (defaults to master)"
echo "Bring the project up without changing submodules: ./dd-ctl all-develop" echo " Bring the current project up: ./dd-ctl all"
echo " Build the compose files: ./dd-ctl build"
echo " Start the project when stopped: ./dd-ctl up" echo " Start the project when stopped: ./dd-ctl up"
echo " Stop the project when started: ./dd-ctl down" echo " Stop the project when started: ./dd-ctl down"
echo " Apply customizations: ./dd-ctl customize" echo " Apply customizations: ./dd-ctl customize"
@ -28,15 +29,14 @@ cp digitaldemocratic.conf .env
CUSTOM_PATH=$(pwd) CUSTOM_PATH=$(pwd)
. ./.env . ./.env
prepare_submodules(){ update_repo(){
if [ ! "$BRANCH" = "develop" ]; then git fetch && git reset --hard origin/$BRANCH
git submodule update --init --recursive git submodule update --init --recursive
cd isard-apps && git fetch && git reset --hard origin/$BRANCH && cd .. cd isard-apps && git fetch && git reset --hard origin/$BRANCH && cd ..
cd isard-sso && git fetch && git reset --hard origin/$BRANCH && cd .. cd isard-sso && git fetch && git reset --hard origin/$BRANCH && cd ..
fi
} }
prepare(){ build(){
## Prepare apps environment ## Prepare apps environment
cp .env isard-apps/.env cp .env isard-apps/.env
echo "CUSTOM_PATH=$CUSTOM_PATH" >> isard-apps/.env echo "CUSTOM_PATH=$CUSTOM_PATH" >> isard-apps/.env
@ -87,10 +87,6 @@ prepare(){
config > apps.yml config > apps.yml
docker-compose -f sso.yml -f apps.yml config > docker-compose.yml docker-compose -f sso.yml -f apps.yml config > docker-compose.yml
rm sso.yml apps.yml rm sso.yml apps.yml
}
build(){
docker-compose build docker-compose build
} }
@ -173,9 +169,10 @@ setup_wordpress(){
## Multisite ## Multisite
docker exec -ti isard-apps-wordpress /bin/sh -c "/multisite.sh" docker exec -ti isard-apps-wordpress /bin/sh -c "/multisite.sh"
docker exec -ti isard-apps-wordpress /bin/sh -c "if [ ! -d /var/www/html/wp-content/plugins/saml/onelogin-saml-sso ]; then cp -R /plugins/saml/onelogin-saml-sso /var/www/html/wp-content/plugins/; fi" # docker exec -ti isard-apps-wordpress /bin/sh -c "if [ ! -d /var/www/html/wp-content/plugins/saml/onelogin-saml-sso ]; then cp -R /plugins/saml/onelogin-saml-sso /var/www/html/wp-content/plugins/; fi"
docker exec -ti isard-apps-wordpress /bin/sh -c "if [ ! -d /var/www/html/wp-content/mu-plugins ]; then cp -R /plugins/mu-plugins /var/www/html/wp-content/; fi" # docker exec -ti isard-apps-wordpress /bin/sh -c "if [ ! -d /var/www/html/wp-content/mu-plugins ]; then cp -R /plugins/mu-plugins /var/www/html/wp-content/; fi"
docker-compose run --user=33 isard-apps-wordpress-cli /bin/bash -c 'wp plugin install onelogin-saml-sso --activate'
# docker-compose run isard-apps-wordpress-cli /bin/bash -c 'wp plugin activate onelogin-saml-sso --network'
} }
setup_keycloak(){ setup_keycloak(){
@ -251,6 +248,7 @@ extras_develop(){
} }
upgrade_plugins_moodle(){ upgrade_plugins_moodle(){
wait_for_moodle
rm -rf /tmp/moodle rm -rf /tmp/moodle
mkdir -p /tmp/moodle/mod mkdir -p /tmp/moodle/mod
@ -259,45 +257,47 @@ upgrade_plugins_moodle(){
mkdir -p /tmp/moodle/theme/cbe mkdir -p /tmp/moodle/theme/cbe
mkdir -p /tmp/moodle/blocks mkdir -p /tmp/moodle/blocks
curl --location https://moodle.org/plugins/download.php/25078/mod_jitsi_moodle311_2021090100.zip > jitsi.zip curl --location $MOODLE_PLUGIN_JITSI > jitsi.zip
unzip jitsi.zip -d /tmp/moodle/mod/ unzip jitsi.zip -d /tmp/moodle/mod/
rm jitsi.zip rm jitsi.zip
curl --location https://moodle.org/plugins/download.php/24977/mod_bigbluebuttonbn_moodle311_2019101011.zip > bbb.zip curl --location $MOODLE_PLUGIN_BBB > bbb.zip
unzip bbb.zip -d /tmp/moodle/mod/ unzip bbb.zip -d /tmp/moodle/mod/
rm bbb.zip rm bbb.zip
curl --location https://github.com/isard-vdi/moodle-auth_saml2/archive/refs/heads/role_map.zip > auth_saml2.zip # curl --location https://github.com/isard-vdi/moodle-auth_saml2/archive/refs/heads/role_map.zip > auth_saml2.zip
# curl --location https://moodle.org/plugins/download.php/24556/auth_saml2_moodle311_2021062900.zip > auth_saml2.zip
curl --location $MOODLE_PLUGIN_SAML > auth_saml2.zip
unzip auth_saml2.zip -d /tmp/moodle/auth/ unzip auth_saml2.zip -d /tmp/moodle/auth/
mv /tmp/moodle/auth/moodle-auth_saml2-role_map/* /tmp/moodle/auth/saml2/ mv /tmp/moodle/auth/moodle-auth_saml2-role_map/* /tmp/moodle/auth/saml2/
rm -rf /tmp/moodle/auth/moodle-auth_saml2-role_map rm -rf /tmp/moodle/auth/moodle-auth_saml2-role_map
rm auth_saml2.zip rm auth_saml2.zip
curl --location https://github.com/3iPunt/moodle_mod_tresipuntshare/archive/refs/heads/master.zip > tresipuntshare.zip curl --location $MOODLE_PLUGIN_TRESIPUNTSHARE > tresipuntshare.zip
unzip tresipuntshare.zip -d /tmp/moodle/mod/ unzip tresipuntshare.zip -d /tmp/moodle/mod/
mv /tmp/moodle/mod/moodle_mod_tresipuntshare-master /tmp/moodle/mod/tresipuntshare mv /tmp/moodle/mod/moodle_mod_tresipuntshare-master /tmp/moodle/mod/tresipuntshare
rm tresipuntshare.zip rm tresipuntshare.zip
curl --location https://github.com/3iPunt/moodle_mod_tresipuntvideo/archive/refs/heads/master.zip > tresipuntvideo.zip curl --location $MOODLE_PLUGIN_TRESIPUNTVIDEO > tresipuntvideo.zip
unzip tresipuntvideo.zip -d /tmp/moodle/mod/ unzip tresipuntvideo.zip -d /tmp/moodle/mod/
mv /tmp/moodle/mod/moodle_mod_tresipuntvideo-master /tmp/moodle/mod/tresipuntvideo mv /tmp/moodle/mod/moodle_mod_tresipuntvideo-master /tmp/moodle/mod/tresipuntvideo
rm tresipuntvideo.zip rm tresipuntvideo.zip
curl --location https://github.com/3iPunt/moodle_mod_tresipuntaudio/archive/refs/heads/master.zip > tresipuntaudio.zip curl --location $MOODLE_PLUGIN_TRESIPUNTAUDIO > tresipuntaudio.zip
unzip tresipuntaudio.zip -d /tmp/moodle/mod/ unzip tresipuntaudio.zip -d /tmp/moodle/mod/
mv /tmp/moodle/mod/moodle_mod_tresipuntaudio-master /tmp/moodle/mod/tresipuntaudio mv /tmp/moodle/mod/moodle_mod_tresipuntaudio-master /tmp/moodle/mod/tresipuntaudio
rm tresipuntaudio.zip rm tresipuntaudio.zip
curl --location https://github.com/3iPunt/moodle_assignsubmission_tipnc/archive/refs/heads/master.zip > assignsubmission_tipnc.zip curl --location $MOODLE_PLUGIN_ASSIGNSUBMISSION > assignsubmission_tipnc.zip
unzip assignsubmission_tipnc.zip -d /tmp/moodle/mod/assign/submission/ unzip assignsubmission_tipnc.zip -d /tmp/moodle/mod/assign/submission/
mv /tmp/moodle/mod/assign/submission/moodle_assignsubmission_tipnc-master /tmp/moodle/mod/assign/submission/tipnc mv /tmp/moodle/mod/assign/submission/moodle_assignsubmission_tipnc-master /tmp/moodle/mod/assign/submission/tipnc
rm assignsubmission_tipnc.zip rm assignsubmission_tipnc.zip
curl --location https://gitlab.com/digitaldemocratic/digitaldemocratic/-/raw/master/custom.sample/moodle/plugins/block_tresipuntmodspend.zip?inline=false > block_tresipuntmodspend.zip curl --location $MOODLE_PLUGIN_TRESIPUNTMODSPEND > block_tresipuntmodspend.zip
unzip block_tresipuntmodspend.zip -d /tmp/moodle/blocks/ unzip block_tresipuntmodspend.zip -d /tmp/moodle/blocks/
rm block_tresipuntmodspend.zip rm block_tresipuntmodspend.zip
curl --location https://github.com/3iPunt/moodle_theme_cbe/archive/refs/heads/master.zip > tresipunt_theme_cbe.zip curl --location $MOODLE_THEME_CBE > tresipunt_theme_cbe.zip
unzip tresipunt_theme_cbe.zip -d /tmp/moodle/theme/cbe/ unzip tresipunt_theme_cbe.zip -d /tmp/moodle/theme/cbe/
mv /tmp/moodle/theme/cbe/moodle_theme_cbe-master/* /tmp/moodle/theme/cbe/ mv /tmp/moodle/theme/cbe/moodle_theme_cbe-master/* /tmp/moodle/theme/cbe/
rm tresipunt_theme_cbe.zip rm tresipunt_theme_cbe.zip
@ -311,33 +311,32 @@ upgrade_plugins_moodle(){
upgrade_plugins_wp(){ upgrade_plugins_wp(){
## MU-PLUGINS WP ## MU-PLUGINS WP
rm -rf /tmp/muplugins-google-sites-master docker-compose run --user=root isard-apps-wordpress-cli /bin/bash -c 'curl --location https://gitlab.com/muplugins-multiste1/muplugins-google-sites/-/archive/master/muplugins-google-sites-master.zip > muplugins.zip; \
curl --location https://gitlab.com/muplugins-multiste1/muplugins-google-sites/-/archive/master/muplugins-google-sites-master.zip > muplugins.zip unzip muplugins.zip; \
unzip muplugins.zip -d /tmp/ rm -rf /var/www/html/wp-content/mu-plugins/*; \
cp -R /tmp/muplugins-google-sites-master/mu-plugins/* /opt/digitaldemocratic/src/wordpress/wp-content/mu-plugins/ mkdir -p /var/www/html/wp-content/mu-plugins; \
rm muplugins.zip cp -R muplugins-google-sites-master/mu-plugins/* /var/www/html/wp-content/mu-plugins/; \
rm /tmp/muplugins-google-sites-master -rf chown -R 33:33 /var/www/html/wp-content/mu-plugins; \
rm muplugins.zip; \
rm muplugins-google-sites-master -rf;'
} }
if [ "$OPERATION" = "prepare" ]; then if [ "$OPERATION" = "repo-update" ]; then
prepare_submodules update_repo
prepare
build
fi fi
if [ "$OPERATION" = "build" ]; then if [ "$OPERATION" = "build" ]; then
prepare_submodules
prepare
build build
fi fi
if [ "$OPERATION" = "up" ]; then if [ "$OPERATION" = "up" ]; then
prepare_submodules
prepare
build
up up
fi fi
if [ "$OPERATION" = "down" ]; then
down
fi
if [ "$OPERATION" = "customize" ]; then if [ "$OPERATION" = "customize" ]; then
up up
wait_for_moodle wait_for_moodle
@ -348,25 +347,31 @@ fi
if [ "$OPERATION" = "saml" ]; then if [ "$OPERATION" = "saml" ]; then
up up
wait_for_moodle
saml_certificates saml_certificates
fi fi
if [ "$OPERATION" = "all" ]; then if [ "$OPERATION" = "all" ]; then
prepare_submodules
prepare
build build
up up
wait_for_moodle wait_for_moodle
upgrade_plugins_moodle
upgrade_plugins_wp
setup_nextcloud setup_nextcloud
setup_wordpress setup_wordpress
setup_moodle setup_moodle
saml_certificates saml_certificates
echo "\n\n" echo "\n\n"
echo " #### After install ####" echo " #### After install ####"
echo " - SSO in moodle should be active. You can go to: https://moodle.$DOMAIN" echo " - SSO in moodle should be active. You can go to: https://moodle.$DOMAIN"
echo " If it fails, regenerate and lock certificate in moodle SAML2 connector as a local admin."
echo " After that run ./dd-ctl saml"
echo " - SSO in nextcloud should be active. You can go to: https://nextcloud.$DOMAIN" echo " - SSO in nextcloud should be active. You can go to: https://nextcloud.$DOMAIN"
echo " - SSO in wordpress needs manual activation. You should go to https://wp.$DOMAIN/wp-admin//plugins.php " echo " - SSO in wordpress should be active. You should go to https://wp.$DOMAIN/wp-admin//plugins.php "
echo " and activate 'OneLogin SAML SSO' plugin" echo " and activate 'OneLogin SAML SSO' plugin"
echo "\n\n" echo "\n\n"
@ -375,28 +380,23 @@ if [ "$OPERATION" = "all" ]; then
fi fi
if [ "$OPERATION" = "upgrade-plugins" ]; then if [ "$OPERATION" = "upgrade-plugins" ]; then
upgrade_plugins_moodle
upgrade_plugins_wp
fi
if [ "$OPERATION" = "all-develop" ]; then
prepare
build
up up
wait_for_moodle wait_for_moodle
setup_nextcloud upgrade_plugins_moodle
setup_wordpress upgrade_plugins_wp
setup_moodle
saml_certificates
fi fi
if [ "$OPERATION" = "adminer" ]; then if [ "$OPERATION" = "adminer" ]; then
extras_adminer extras_adminer
fi fi
if [ "$OPERATION" = "reset-7941" ]; then if [ "$OPERATION" = "pgtuner" ]; then
extras_pgtuner
fi
if [ "$OPERATION" = "reset-1714" ]; then
echo "Resetting all but certificates" echo "Resetting all but certificates"
docker-compose down down
rm -rf /opt/digitaldemocratic/backup rm -rf /opt/digitaldemocratic/backup
rm -rf /opt/digitaldemocratic/data rm -rf /opt/digitaldemocratic/data
rm -rf /opt/digitaldemocratic/db rm -rf /opt/digitaldemocratic/db

View File

@ -110,6 +110,16 @@ MOODLE_IMG=erseco/alpine-php7-webserver:1.10.0
MOODLE_VERSION=MOODLE_311_STABLE MOODLE_VERSION=MOODLE_311_STABLE
MOODLE_MAX_FILESIZE_UPLOAD=50M MOODLE_MAX_FILESIZE_UPLOAD=50M
MOODLE_PLUGIN_JITSI=https://moodle.org/plugins/download.php/23360/mod_jitsi_moodle310_2021052500.zip
MOODLE_PLUGIN_BBB=https://moodle.org/plugins/download.php/23294/mod_bigbluebuttonbn_moodle310_2019101009.zip
MOODLE_PLUGIN_SAML=https://github.com/isard-vdi/moodle-auth_saml2/archive/refs/heads/role_map.zip
MOODLE_PLUGIN_TRESIPUNTSHARE=https://github.com/3iPunt/moodle_mod_tresipuntshare/archive/refs/heads/master.zip
MOODLE_PLUGIN_TRESIPUNTVIDEO=https://github.com/3iPunt/moodle_mod_tresipuntvideo/archive/refs/heads/master.zip
MOODLE_PLUGIN_TRESIPUNTAUDIO=https://github.com/3iPunt/moodle_mod_tresipuntaudio/archive/refs/heads/master.zip
MOODLE_PLUGIN_ASSIGNSUBMISSION=https://github.com/3iPunt/moodle_assignsubmission_tipnc/archive/refs/heads/master.zip
MOODLE_PLUGIN_TRESIPUNTMODSPEND=https://gitlab.com/digitaldemocratic/digitaldemocratic/-/raw/master/custom.sample/moodle/plugins/block_tresipuntmodspend.zip?inline=false
MOODLE_THEME_CBE=https://github.com/3iPunt/moodle_theme_cbe/archive/refs/heads/master.zip
## NEXTCLOUD ## NEXTCLOUD
NEXTCLOUD_IMG=nextcloud:21.0.2-fpm-alpine NEXTCLOUD_IMG=nextcloud:21.0.2-fpm-alpine

@ -1 +1 @@
Subproject commit f8dd910b724ce7955948d27d17c840bb01faf2af Subproject commit cb96478a2ddf977fb394e3e4b117be16b47f9773