2021-04-08 13:52:16 +02:00
|
|
|
#!make
|
2021-05-25 19:19:42 +02:00
|
|
|
|
|
|
|
# if [ ! -d "custom" ]; then echo "You need to copy custom.sample to custom folder and adapt." && exit 1; fi
|
|
|
|
# if [ ! -f "digitaldemocratic.conf" ]; then echo "You need to copy digitaldemocratic.conf.sample to .sample to custom folder and adapt" && exit 1; fi
|
|
|
|
# folder and adapt before bringing up." && exit 1; fi
|
|
|
|
|
2021-04-08 13:52:16 +02:00
|
|
|
include digitaldemocratic.conf
|
|
|
|
export $(shell sed 's/=.*//' digitaldemocratic.conf)
|
|
|
|
|
|
|
|
VERSION := 0.0.1-rc0
|
|
|
|
export VERSION
|
|
|
|
|
2021-05-19 13:49:42 +02:00
|
|
|
CUSTOM_PATH=$(shell pwd)
|
2021-04-08 13:52:16 +02:00
|
|
|
|
2021-05-28 15:52:45 +02:00
|
|
|
.PHONY: all
|
|
|
|
all: add-plugins
|
|
|
|
|
2021-05-19 19:09:24 +02:00
|
|
|
.PHONY: environment
|
2021-04-08 13:52:16 +02:00
|
|
|
environment:
|
2021-05-12 21:20:33 +02:00
|
|
|
git submodule update --init --recursive
|
2021-05-19 13:49:42 +02:00
|
|
|
mkdir -p custom/system/keycloak
|
|
|
|
cp -R isard-sso/docker/keycloak/themes custom/system/keycloak/
|
|
|
|
cp custom/login/logo.png custom/system/keycloak/themes/liiibrelite/login/resources/img/logo.png
|
|
|
|
cp custom/login/background.png custom/system/keycloak/themes/liiibrelite/login/resources/img/loginBG.png
|
2021-05-30 17:45:02 +02:00
|
|
|
cp custom/login/background.png custom/system/keycloak/themes/liiibrelite/login/resources/img/loginBG2.png
|
2021-05-19 13:49:42 +02:00
|
|
|
cp custom/login/style.css custom/system/keycloak/themes/liiibrelite/login/resources/css/
|
2021-05-25 19:19:42 +02:00
|
|
|
|
|
|
|
# Prepare apps environment
|
2021-04-08 13:52:16 +02:00
|
|
|
cp digitaldemocratic.conf isard-apps/.env
|
2021-05-19 13:49:42 +02:00
|
|
|
echo "CUSTOM_PATH=$(CUSTOM_PATH)" >> isard-apps/.env
|
|
|
|
echo "BUILD_ROOT_PATH=$(CUSTOM_PATH)/isard-apps" >> isard-apps/.env
|
2021-04-08 13:52:16 +02:00
|
|
|
cp isard-apps/.env isard-apps/docker/postgresql && \
|
|
|
|
cp isard-apps/.env isard-apps/docker/mariadb && \
|
|
|
|
cp isard-apps/.env isard-apps/docker/moodle && \
|
|
|
|
cp isard-apps/.env isard-apps/docker/nextcloud && \
|
|
|
|
cp isard-apps/.env isard-apps/docker/wordpress && \
|
|
|
|
cp isard-apps/.env isard-apps/docker/etherpad
|
|
|
|
|
2021-05-25 19:19:42 +02:00
|
|
|
# Prepare sso environment
|
|
|
|
cp digitaldemocratic.conf isard-sso/.env
|
|
|
|
echo "CUSTOM_PATH=$(CUSTOM_PATH)" >> isard-sso/.env
|
|
|
|
echo "BUILD_ROOT_PATH=$(CUSTOM_PATH)/isard-sso" >> isard-sso/.env
|
|
|
|
cp isard-sso/.env isard-sso/docker-compose-parts/.env
|
2021-04-08 13:52:16 +02:00
|
|
|
|
2021-05-19 19:19:16 +02:00
|
|
|
|
2021-05-19 19:09:24 +02:00
|
|
|
.PHONY: build
|
2021-04-08 13:52:16 +02:00
|
|
|
build: environment
|
2021-05-26 13:28:41 +02:00
|
|
|
echo CUSTOM_PATH=$(CUSTOM_PATH) > .env
|
|
|
|
echo BUILD_ROOT_PATH=$(CUSTOM_PATH)/isard-sso >> .env
|
2021-04-08 13:52:16 +02:00
|
|
|
docker-compose -f isard-sso/docker-compose-parts/haproxy.yml \
|
2021-05-12 21:20:33 +02:00
|
|
|
-f isard-sso/docker-compose-parts/api.yml \
|
2021-04-08 13:52:16 +02:00
|
|
|
-f isard-sso/docker-compose-parts/keycloak.yml \
|
|
|
|
-f isard-sso/docker-compose-parts/avatars.yml \
|
|
|
|
-f isard-apps/docker/postgresql/postgresql.yml \
|
2021-05-23 20:20:19 +02:00
|
|
|
-f isard-sso/docker-compose-parts/admin.yml \
|
|
|
|
-f isard-sso/docker-compose-parts/backup.yml \
|
2021-05-29 16:25:29 +02:00
|
|
|
-f isard-sso/docker-compose-parts/adminer.yml \
|
2021-04-08 13:52:16 +02:00
|
|
|
config > sso.yml
|
2021-05-19 19:19:16 +02:00
|
|
|
#-f isard-sso/docker-compose-parts/freeipa.yml
|
2021-05-19 18:14:02 +02:00
|
|
|
echo BUILD_ROOT_PATH=$(CUSTOM_PATH)/isard-apps > .env
|
2021-04-08 13:52:16 +02:00
|
|
|
docker-compose -f isard-apps/docker/moodle/moodle.yml \
|
|
|
|
-f isard-apps/docker/nextcloud/nextcloud.yml \
|
|
|
|
-f isard-apps/docker/wordpress/wordpress.yml \
|
|
|
|
-f isard-apps/docker/etherpad/etherpad.yml \
|
|
|
|
-f isard-apps/docker/onlyoffice/onlyoffice.yml \
|
|
|
|
-f isard-apps/docker/redis/redis.yml \
|
|
|
|
-f isard-apps/docker/postgresql/postgresql.yml \
|
|
|
|
-f isard-apps/docker/mariadb/mariadb.yml \
|
|
|
|
-f isard-apps/docker/network.yml \
|
|
|
|
config > apps.yml
|
2021-05-23 20:20:19 +02:00
|
|
|
docker-compose -f sso.yml -f apps.yml config > docker-compose.yml
|
|
|
|
rm sso.yml apps.yml
|
2021-04-08 13:52:16 +02:00
|
|
|
docker-compose build
|
|
|
|
|
2021-05-19 19:09:24 +02:00
|
|
|
.PHONY: up
|
2021-04-08 13:52:16 +02:00
|
|
|
up: build
|
|
|
|
docker-compose up -d --no-deps
|
|
|
|
|
2021-05-19 19:09:24 +02:00
|
|
|
.PHONY: down
|
2021-04-08 13:52:16 +02:00
|
|
|
down:
|
|
|
|
docker-compose down
|
|
|
|
|
2021-05-29 17:56:24 +02:00
|
|
|
# .PHONY: remove
|
|
|
|
# remove: down
|
|
|
|
# rm -rf /opt/digitaldemocratic/postgres
|
|
|
|
# rm -rf /opt/digitaldemocratic/redis
|
|
|
|
# rm -rf /opt/digitaldemocratic/wordpress
|
|
|
|
# rm -rf /opt/digitaldemocratic/nextcloud
|
|
|
|
# rm -rf /opt/digitaldemocratic/mariadb
|
|
|
|
# rm -rf /opt/digitaldemocratic/freeipa
|
2021-04-08 13:52:16 +02:00
|
|
|
# Leaves haproxy folder with certificates. Remove manually to get new certificates.
|
|
|
|
|
2021-05-19 19:09:24 +02:00
|
|
|
.PHONY: add-plugins
|
2021-05-28 15:52:45 +02:00
|
|
|
add-plugins: connect-saml
|
2021-05-29 10:11:25 +02:00
|
|
|
# Add dd admin user (NOT USED, done in isard-sso-admin)
|
|
|
|
# docker exec isard-sso-keycloak /opt/jboss/keycloak/bin/add-user-keycloak.sh -u $$DDADMIN_USER -p $$DDADMIN_PASSWORD
|
|
|
|
# docker restart isard-sso-keycloak
|
|
|
|
# sleep 10
|
|
|
|
# docker exec -u www-data isard-apps-nextcloud-app sh -c 'export OC_PASS=$$DDADMIN_PASSWORD && php occ user:add --password-from-env --display-name="DD Admin" --group="admin" $$DDADMIN_USER'
|
|
|
|
|
2021-05-28 15:52:45 +02:00
|
|
|
# Wordpress
|
|
|
|
## Multisite
|
|
|
|
docker exec -ti isard-apps-wordpress /bin/sh -c "/multisite.sh"
|
2021-05-30 10:06:20 +02:00
|
|
|
|
|
|
|
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"
|
2021-05-31 08:45:57 +02:00
|
|
|
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"
|
2021-04-08 13:52:16 +02:00
|
|
|
# Nextcloud
|
|
|
|
#cp -R $$BUILD_ROOT_PATH/isard-apps/docker/nextcloud/themes/* $$DATA_FOLDER/nextcloud/themes/
|
2021-05-17 20:39:53 +02:00
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:system:set default_language --value="ca"
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:system:set skeletondirectory --value=''
|
2021-04-08 13:52:16 +02:00
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings app:disable firstrunwizard
|
2021-05-19 19:02:27 +02:00
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings app:disable recommendations
|
2021-04-08 13:52:16 +02:00
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings app:install forms
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings app:install polls
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings app:install calendar
|
2021-05-31 22:06:43 +02:00
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings app:install spreed
|
2021-04-08 13:52:16 +02:00
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:system:set theme --value=digitaldemocratic
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:system:set allow_local_remote_servers --value=true
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings maintenance:theme:update
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "su - www-data -s /bin/sh -c 'PHP_MEMORY_LIMIT=512M php /var/www/html/occ app:disable dashboard'"
|
|
|
|
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "su - www-data -s /bin/sh -c 'PHP_MEMORY_LIMIT=512M php /var/www/html/occ app:install mail'"
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "su - www-data -s /bin/sh -c 'PHP_MEMORY_LIMIT=512M php /var/www/html/occ app:enable mail'"
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "su - www-data -s /bin/sh -c 'PHP_MEMORY_LIMIT=512M php /var/www/html/occ app:install user_saml'"
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "su - www-data -s /bin/sh -c 'PHP_MEMORY_LIMIT=512M php /var/www/html/occ app:enable user_saml'"
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "su - www-data -s /bin/sh -c 'PHP_MEMORY_LIMIT=512M php /var/www/html/occ app:install ownpad'"
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "/ownpad_cfg.sh"
|
|
|
|
docker exec -ti isard-apps-nextcloud-app /bin/sh -c "su - www-data -s /bin/sh -c 'PHP_MEMORY_LIMIT=512M php /var/www/html/occ app:enable ownpad'"
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:app:set ownpad ownpad_etherpad_enable --value="yes"
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:app:set ownpad ownpad_etherpad_host --value="https://pad.$$DOMAIN"
|
|
|
|
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings app:install onlyoffice
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:app:set onlyoffice DocumentServerUrl --value="https://oof.$$DOMAIN"
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:app:set onlyoffice jwt_secret --value="secret"
|
|
|
|
docker exec -u www-data isard-apps-nextcloud-app php occ --no-warnings config:app:set onlyoffice jwt_header --value="Authorization"
|
|
|
|
|
2021-05-28 02:42:43 +02:00
|
|
|
|
2021-05-28 02:33:50 +02:00
|
|
|
# Allow nextcloud into other apps iframes
|
|
|
|
# Content-Security-Policy: frame-ancestors 'self' *.$$DOMAIN;
|
2021-05-19 18:14:02 +02:00
|
|
|
docker exec -ti isard-apps-nextcloud-app sed -ie "/protected \\\$$allowedFrameAncestors = \[/{n;s/\('\\\\\'self\\\\\'\)\('\)/\1 *.$$DOMAIN\2/}" /var/www/html/lib/public/AppFramework/Http/ContentSecurityPolicy.php
|
|
|
|
|
2021-05-28 02:42:43 +02:00
|
|
|
# Content-Security-Policy: connect-src 'self' *.$$DOMAIN;
|
2021-05-27 15:35:22 +02:00
|
|
|
docker exec -ti isard-apps-nextcloud-app sed -ie "/protected \\\$$allowedConnectDomains = \[/{n;s/\('\\\\\'self\\\\\'\)\('\)/\1 *.$$DOMAIN\2/}" /var/www/html/lib/public/AppFramework/Http/ContentSecurityPolicy.php
|
|
|
|
|
2021-05-28 02:42:43 +02:00
|
|
|
# Content-Security-Policy: img-src 'self' *.$$DOMAIN;
|
2021-05-27 15:35:22 +02:00
|
|
|
docker exec -ti isard-apps-nextcloud-app sed -ie "/protected \\\$$allowedImageDomains = \[/{n;s/\('\\\\\'self\\\\\'\)\('\)/\1 *.$$DOMAIN\2/}" /var/www/html/lib/public/AppFramework/Http/ContentSecurityPolicy.php
|
|
|
|
|
2021-05-28 02:42:43 +02:00
|
|
|
# Content-Security-Policy: style-src 'self' *.$$DOMAIN;
|
2021-05-27 15:35:22 +02:00
|
|
|
docker exec -ti isard-apps-nextcloud-app sed -ie "/protected \\\$$allowedStyleDomains = \[/{n;s/\('\\\\\'self\\\\\'\)\('\)/\1 *.$$DOMAIN\2/}" /var/www/html/lib/public/AppFramework/Http/ContentSecurityPolicy.php
|
2021-05-28 02:33:50 +02:00
|
|
|
|
2021-05-28 02:42:43 +02:00
|
|
|
# Content-Security-Policy: font-src 'self' *.$$DOMAIN;
|
2021-05-27 15:35:22 +02:00
|
|
|
docker exec -ti isard-apps-nextcloud-app sed -ie "/protected \\\$$allowedFontDomains = \[/{n;s/\('\\\\\'self\\\\\'\)\('\)/\1 *.$$DOMAIN\2/}" /var/www/html/lib/public/AppFramework/Http/ContentSecurityPolicy.php
|
2021-05-17 20:39:53 +02:00
|
|
|
|
2021-05-29 10:11:25 +02:00
|
|
|
# CERTIFICATES FOR SAML
|
|
|
|
docker exec -ti isard-sso-admin /bin/sh -c "/admin/generate_certificates.sh"
|
|
|
|
|
2021-05-28 15:52:45 +02:00
|
|
|
# SAML PLUGIN NEXTCLOUD
|
|
|
|
docker exec -ti isard-sso-admin python3 /admin/nextcloud_saml.py
|
|
|
|
|
2021-05-29 10:11:25 +02:00
|
|
|
# SAML PLUGIN WORDPRESS
|
|
|
|
docker exec -ti isard-sso-admin python3 /admin/wordpress_saml.py
|
|
|
|
|
2021-05-28 15:52:45 +02:00
|
|
|
# SAML PLUGIN MOODLE
|
|
|
|
echo "To add SAML to moodle:"
|
|
|
|
echo "1.-Activate SAML plugin in moodle extensions, regenerate certificate, lock certificate"
|
|
|
|
echo "2.-Then run: docker exec -ti isard-sso-admin python3 /admin/nextcloud_saml.py"
|
|
|
|
echo "3.-"
|
|
|
|
|
2021-05-30 10:49:59 +02:00
|
|
|
# Moodle
|
|
|
|
docker exec -ti isard-apps-moodle php7 admin/cli/cfg.php --name=guestloginbutton --set=0
|
|
|
|
docker exec -ti isard-apps-moodle php7 admin/cli/cfg.php --name=enrol_plugins_enabled --set=manual
|
|
|
|
docker exec -ti isard-apps-moodle php7 admin/cli/cfg.php --name=enablemobilewebservice --set=0
|
|
|
|
docker exec -ti isard-apps-moodle php7 admin/cli/cfg.php --name=enablebadges --set=0
|
2021-05-30 08:48:04 +02:00
|
|
|
docker exec -ti isard-apps-moodle php7 admin/cli/purge_caches.php
|
|
|
|
|
2021-04-08 13:52:16 +02:00
|
|
|
|
2021-05-19 19:09:24 +02:00
|
|
|
.PHONY: connect-saml
|
2021-05-28 15:52:45 +02:00
|
|
|
connect-saml: up
|
|
|
|
echo "Waiting for system to be fully up before personalizing... It can take some minutes..."
|
2021-05-18 10:31:00 +02:00
|
|
|
while [ "`docker inspect -f {{.State.Health.Status}} isard-apps-moodle`" != "healthy" ]; do sleep 2; done
|