diff --git a/seafile.service b/seafile.service index 01ba47e..8f05c25 100644 --- a/seafile.service +++ b/seafile.service @@ -10,18 +10,30 @@ MemoryLimit=512M Environment=ROOT_DIR=/srv/seafile Environment=SEAF_MYSQL="" #Empty = Sqlite +Environment=SEAF_HOST="localhost.localdomain" Environment=SEAF_URL="https://seaf.example.com" Environment=SEAF_UPGRADE_INTERVAL=10 +Environment=SEAF_PORT=8080 #Run first once to setup #rkt --insecure-options=image run --dns 8.8.8.8 --volume volume-opt-seafile,kind=host,source=${ROOT_DIR} docker://repo.shimun.net/shimun/seafile --environment=SEAF_URL="https://seaf.example.com" --interactive ExecStartPre=/bin/mkdir -p ${ROOT_DIR} -ExecStart=/usr/bin/rkt --insecure-options=image run --uuid-file-save=${ROOT_DIR}/container.uuid --dns 8.8.8.8 --inherit-env --volume volume-opt-seafile,kind=host,source=${ROOT_DIR} --port 80-tcp:8080 \ - docker://repo.shimun.net/shimun/seafile --environment=SEAF_UPGRADE_INTERVAL=${SEAF_UPGRADE_INTERVAL} + +### Rkt ### +ExecStart=/usr/bin/rkt --insecure-options=image run --uuid-file-save=${ROOT_DIR}/container.uuid --dns 8.8.8.8 --inherit-env --volume volume-opt-seafile,kind=host,source=${ROOT_DIR} --port 80-tcp:{SEAF_PORT} \ + docker://repo.shimun.net/shimun/seafile --environment=SEAF_UPGRADE_INTERVAL=${SEAF_UPGRADE_INTERVAL} + ExecStartPost=/bin/bash -c "echo 'rkt enter --app=seafile $(cat '${ROOT_DIR}'/container.uuid)' > ${ROOT_DIR}/enter.sh && chmod +x ${ROOT_DIR}/enter.sh" -ExecStopPre=/bin/bash -c "rkt enter --app=seafile $(cat ${ROOT_DIR}/container.uuid) 'seafile-server stop'" +ExecStop=/bin/bash -c "rkt enter --app=seafile $(cat ${ROOT_DIR}/container.uuid) 'seafile-server stop'" ExecStopPost=/bin/bash -c "rkt rm $(cat ${ROOT_DIR}/container.uuid)" + +### Docker ### +#ExecStart=/usr/bin/docker run --name seafile --hostname ${SEAF_HOST} -e SEAF_MYSQL "${SEAF_MYSQL}" -e SEAF_URL "${SEAF_URL}" -e SEAF_HOST "${SEAF_HOST}" -e SEAF_UPGRADE_INTERVAL "${SEAF_UPGRADE_INTERVAL}" \ +# -v ${ROOT_DIR}:/opt/seafile -p 80:${SEAF_PORT} repo.shimun.net/shimun/seafile +#ExecStopPre=/bin/bash -c "docker stop seafile" +#ExecStopPost=/bin/bash -c "docker rm seafile" + ExecStopPost=/bin/rm ${ROOT_DIR}/container.uuid KillMode=mixed Restart=always