diff --git a/podman-seafile/05_freshinstall.sh b/podman-seafile/05_freshinstall.sh new file mode 100755 index 0000000..81870ec --- /dev/null +++ b/podman-seafile/05_freshinstall.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_pwd_is_scriptdir +ensure_not_root + +ensure_variables_are_defined "$envvars" + +if [[ -d ~/.local/share/containers/storage/volumes/${dbvolume} ]]; then + echo "Error : conf volume ${dbvolume} already exists." + echo "Please remove it before a freshinstall, or continue with a standard installation." + exit 1 +fi + +if [[ -d ~/.local/share/containers/storage/volumes/${datavolume} ]]; then + echo "Error : data volume ${datavolume} already exists." + echo "Please remove it before a freshinstall, or continue with a standard installation." + exit 1 +fi + +podman volume create ${dbvolume} +podman volume create ${datavolume} diff --git a/podman-seafile/10_install.sh b/podman-seafile/10_install.sh new file mode 100755 index 0000000..bbab79e --- /dev/null +++ b/podman-seafile/10_install.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_pwd_is_scriptdir +ensure_not_root + +ensure_variables_are_defined "$envvars" + +if [[ ! -d ~/.local/share/containers/storage/volumes/${dbvolume} ]]; then + echo "Error : conf volume ${dbvolume} does not exists. Consider running 05_freshinstall.sh if this is the first install." + exit 1 +fi + +if [[ ! -d ~/.local/share/containers/storage/volumes/${datavolume} ]]; then + echo "Error : data volume ${datavolume} does not exists. Consider running 05_freshinstall.sh if this is the first install." + exit 1 +fi + +cat <> .env +MYSQL_ROOT_PASSWORD=${GARBAYE_SEAFILE_MYSQL_ROOT_PASSWORD} +DB_ROOT_PASSWD=${GARBAYE_SEAFILE_MYSQL_ROOT_PASSWORD} +SEAFILE_ADMIN_PASSWORD=${GARBAYE_SEAFILE_ADMIN_PASSWORD} +SEAFILE_SERVER_HOSTNAME=${GARBAYE_SEAFILE_SERVER_HOSTNAME} +SEAFILE_ADMIN_EMAIL=${GARBAYE_SEAFILE_ADMIN_EMAIL} +EOT + +export GARBAYE_SEAFILE_SEAFILE_VERSION="${seafile_release}" +podman-compose up -d + +echo -n "Waiting for seahub_settings.py " +while [ ! -e `podman volume inspect --format '{{ .Mountpoint }}' ${datavolume}`/seafile/conf/seahub_settings.py ]; do + echo -n "." + sleep 1 +done ; echo "OK" + +sed_in_place "^FILE_SERVER_ROOT = \"http://${GARBAYE_SEAFILE_SERVER_HOSTNAME}/seafhttp\"" "FILE_SERVER_ROOT = \"https://${GARBAYE_SEAFILE_SERVER_HOSTNAME}/seafhttp\"\nEMAIL_USE_TLS = False\nEMAIL_HOST = '${GARBAYE_SEAFILE_SMTP_SERVER}'\nEMAIL_HOST_USER = ''\nEMAIL_HOST_PASSWORD = ''\nEMAIL_PORT = 25\nDEFAULT_FROM_EMAIL = 'noreply@seafile.garbaye.fr'\nSERVER_EMAIL = 'noreply@seafile.garbaye.fr'" `podman volume inspect --format '{{ .Mountpoint }}' ${datavolume}`/seafile/conf/seahub_settings.py + +shred -u .env + +./40_stop.sh + +echo All good : pod ${pod_name} built and stopped diff --git a/podman-seafile/docker-compose.yml b/podman-seafile/docker-compose.yml index c89fd5d..f4c3bda 100644 --- a/podman-seafile/docker-compose.yml +++ b/podman-seafile/docker-compose.yml @@ -2,12 +2,13 @@ version: '2.0' services: db: image: docker.io/library/mariadb:10.2 - container_name: seafile-mysql + container_name: seafile-db environment: - - MYSQL_ROOT_PASSWORD=${GARBAYE_SEAFILE_MYSQL_ROOT_PASSWORD} # Requested, set the root's password of MySQL service. - MYSQL_LOG_CONSOLE=true + env_file: + - .env volumes: - - seafile-mysql:/var/lib/mysql:Z # Requested, specifies the path to MySQL data persistent store. + - seafile-db:/var/lib/mysql:Z networks: - seafile-net @@ -19,22 +20,18 @@ services: - seafile-net seafile: - image: docker.io/seafileltd/seafile-mc:8.0.8 + image: "docker.io/seafileltd/seafile-mc:${GARBAYE_SEAFILE_SEAFILE_VERSION}" container_name: seafile ports: - - "127.0.0.1:8000:8000" - - "127.0.0.1:8080:8080" - - "127.0.0.1:8082:8082" + - "127.0.0.1:8000:80" volumes: - - seafile-data:/shared:Z # Requested, specifies the path to Seafile data persistent store. + - seafile-data:/shared:Z environment: - DB_HOST=db - - DB_ROOT_PASSWD=${GARBAYE_SEAFILE_MYSQL_ROOT_PASSWORD} # Requested, the value shuold be root's password of MySQL service. - - TIME_ZONE=Etc/UTC # Optional, default is UTC. Should be uncomment and set to your local time zone. - - SEAFILE_ADMIN_EMAIL=laposte-seafile@garbaye.fr # Specifies Seafile admin user, default is 'me@example.com'. - - SEAFILE_ADMIN_PASSWORD=${GARBAYE_SEAFILE_ADMIN_PASSWORD} # Specifies Seafile admin password, default is 'asecret'. - - SEAFILE_SERVER_LETSENCRYPT=false # Whether to use https or not. - - SEAFILE_SERVER_HOSTNAME=seafile.garbaye.fr # Specifies your host name if https is enabled. + - TIME_ZONE=Europe/Paris + - SEAFILE_SERVER_LETSENCRYPT=false + env_file: + - .env depends_on: - db - memcached diff --git a/podman-seafile/vars.sh b/podman-seafile/vars.sh index 1f1c373..7bec41e 100644 --- a/podman-seafile/vars.sh +++ b/podman-seafile/vars.sh @@ -2,5 +2,11 @@ pod_name='podman-seafile' service_name="pod-${pod_name}.service" +seafile_release='8.0.8' +dbvolume='podman-seafile_seafile-db' +datavolume='podman-seafile_seafile-data' +get_default_iface_ipv4 GARBAYE_SEAFILE_SMTP_SERVER +GARBAYE_SEAFILE_SERVER_HOSTNAME="${GARBAYE_SERVER_HOSTNAME:-seafile.garbaye.fr}" +GARBAYE_SEAFILE_ADMIN_EMAIL="${GARBAYE_SEAFILE_ENV_ADMIN_EMAIL:-laposte-seafile@garbaye.fr}" +envvars='GARBAYE_SEAFILE_MYSQL_ROOT_PASSWORD' upstream_images="docker.io/seafileltd/seafile-mc docker.io/library/mariadb docker.io/library/memcached" -version='8.0.8'