generated from coop-cloud/example
Compare commits
35 Commits
use-multi-
...
2.11.0+9.0
Author | SHA1 | Date | |
---|---|---|---|
6c8b7dd2a7 | |||
04caca0798
|
|||
45d1f09317 | |||
b571899521 | |||
c1fa536df2 | |||
807b095441 | |||
5f3dcb4256 | |||
3022729f66 | |||
450c1cdca0 | |||
bb99499b91 | |||
b681d6ef44 | |||
928469f6eb | |||
3072d4c33c | |||
c9ed2edd8f | |||
012b672e7a | |||
f1a5a09dc7 | |||
4b9c7a8c1a | |||
29488fd16d | |||
ee332f5edd | |||
fce4120f09 | |||
cb08027aed | |||
364d87db5f | |||
1ed3618203 | |||
0ee47375be | |||
f1c04acbf0 | |||
89ca6f28d6 | |||
a2da977365 | |||
fc5a011cee | |||
cab00b6823 | |||
40ebabd93e | |||
dc6bb69b12 | |||
5a3d27754b | |||
bc039e8bb2 | |||
655483d7f5 | |||
40438168ff |
23
.drone.yml
23
.drone.yml
@ -3,10 +3,12 @@ kind: pipeline
|
|||||||
name: deploy to swarm-test.autonomic.zone
|
name: deploy to swarm-test.autonomic.zone
|
||||||
steps:
|
steps:
|
||||||
- name: deployment
|
- name: deployment
|
||||||
image: decentral1se/stack-ssh-deploy:latest
|
image: git.coopcloud.tech/coop-cloud/stack-ssh-deploy:latest
|
||||||
settings:
|
settings:
|
||||||
host: swarm-test.autonomic.zone
|
host: swarm-test.autonomic.zone
|
||||||
stack: onlyoffice
|
stack: onlyoffice
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
generate_secrets: true
|
generate_secrets: true
|
||||||
purge: true
|
purge: true
|
||||||
deploy_key:
|
deploy_key:
|
||||||
@ -15,16 +17,25 @@ steps:
|
|||||||
DOMAIN: onlyoffice.swarm-test.autonomic.zone
|
DOMAIN: onlyoffice.swarm-test.autonomic.zone
|
||||||
STACK_NAME: onlyoffice
|
STACK_NAME: onlyoffice
|
||||||
LETS_ENCRYPT_ENV: production
|
LETS_ENCRYPT_ENV: production
|
||||||
|
ENTRYPOINT_VERSION: v1
|
||||||
|
SECRET_DB_PASSWORD_VERSION: v1
|
||||||
|
PG_BACKUP_VERSION: v2
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: recipe release
|
name: generate recipe catalogue
|
||||||
steps:
|
steps:
|
||||||
- name: release a new version
|
- name: release a new version
|
||||||
image: thecoopcloud/drone-abra:latest
|
image: plugins/downstream
|
||||||
settings:
|
settings:
|
||||||
command: recipe onlyoffice release
|
server: https://build.coopcloud.tech
|
||||||
deploy_key:
|
token:
|
||||||
from_secret: abra_bot_deploy_key
|
from_secret: drone_abra-bot_token
|
||||||
|
fork: true
|
||||||
|
repositories:
|
||||||
|
- toolshed/auto-recipes-catalogue-json
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event: tag
|
||||||
|
15
.env.sample
15
.env.sample
@ -1,3 +1,16 @@
|
|||||||
TYPE=onlyoffice
|
TYPE=onlyoffice
|
||||||
DOMAIN=onlyoffice.example.com
|
TIMEOUT=300
|
||||||
|
ENABLE_AUTO_UPDATE=true
|
||||||
LETS_ENCRYPT_ENV=production
|
LETS_ENCRYPT_ENV=production
|
||||||
|
ENABLE_BACKUPS=true
|
||||||
|
DOMAIN=onlyoffice.example.com
|
||||||
|
|
||||||
|
SECRET_DB_PASSWORD_VERSION=v1
|
||||||
|
|
||||||
|
AUTO_ASSEMBLY_ENABLED=false
|
||||||
|
AUTO_ASSEMBLY_INTERVAL=5min
|
||||||
|
AUTO_ASSEMBLY_STEP=1min
|
||||||
|
#
|
||||||
|
# Uncomment to enable JWT Secret
|
||||||
|
# COMPOSE_FILE=compose.yml:compose.jwt.yml
|
||||||
|
# SECRET_JWT_SECRET_VERSION=v1
|
||||||
|
18
README.md
18
README.md
@ -7,17 +7,21 @@
|
|||||||
* **Category**: Apps
|
* **Category**: Apps
|
||||||
* **Status**: 3, stable
|
* **Status**: 3, stable
|
||||||
* **Image**: [`onlyoffice`](https://hub.docker.com/r/onlyoffice/documentserver/), 4, upstream
|
* **Image**: [`onlyoffice`](https://hub.docker.com/r/onlyoffice/documentserver/), 4, upstream
|
||||||
* **Healthcheck**: No
|
* **Healthcheck**: Yes
|
||||||
* **Backups**: No
|
* **Backups**: No
|
||||||
* **Email**: 3
|
* **Email**: N/A
|
||||||
* **Tests**: 2
|
* **Tests**: 2
|
||||||
* **SSO**: No
|
* **SSO**: No
|
||||||
<!-- endmetadata -->
|
<!-- endmetadata -->
|
||||||
|
|
||||||
## Basic usage
|
## Basic usage
|
||||||
|
|
||||||
1. Set up Docker Swarm and [`abra`](https://git.autonomic.zone/coop-cloud/abra)
|
* `abra app new onlyoffice`
|
||||||
1. Deploy [`coop-cloud/traefik`](https://git.autonomic.zone/coop-cloud/traefik)
|
* `abra app config <app-name>`
|
||||||
1. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
|
- uncomment `COMPOSE_FILE` and `SECRET_JWT_SECRET_VERSION` to enable JWT Secret
|
||||||
your Docker swarm box
|
* `abra app secret generate -a <app-name>`
|
||||||
1. `abra app YOURAPPDOMAIN deploy`
|
* `abra app deploy <app-name>`
|
||||||
|
|
||||||
|
|
||||||
|
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech) and [`ONLYOFFICE/Docker-DocumentServer`](https://github.com/ONLYOFFICE/Docker-DocumentServer).
|
||||||
|
[Official Onlyoffice docker compose](https://github.com/ONLYOFFICE/Docker-DocumentServer/blob/master/docker-compose.yml)
|
||||||
|
6
abra.sh
6
abra.sh
@ -0,0 +1,6 @@
|
|||||||
|
export ENTRYPOINT_VERSION=v1
|
||||||
|
export PG_BACKUP_VERSION=v2
|
||||||
|
|
||||||
|
prepare_shutdown () {
|
||||||
|
documentserver-prepare4shutdown.sh
|
||||||
|
}
|
||||||
|
6
alaconnect.yml
Normal file
6
alaconnect.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
nextcloud:
|
||||||
|
uncomment:
|
||||||
|
- compose.jwt.yml
|
||||||
|
- SECRET_JWT_SECRET_VERSION
|
||||||
|
shared_secrets:
|
||||||
|
onlyoffice_jwt: jwt_secret
|
15
compose.jwt.yml
Normal file
15
compose.jwt.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
environment:
|
||||||
|
- JWT_ENABLED=true
|
||||||
|
- JWT_HEADER=Authorization
|
||||||
|
- JWT_IN_BODY=true
|
||||||
|
- JWT_SECRET_FILE=/run/secrets/jwt_secret
|
||||||
|
secrets:
|
||||||
|
- jwt_secret
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
jwt_secret:
|
||||||
|
external: true
|
||||||
|
name: ${STACK_NAME}_jwt_secret_${SECRET_JWT_SECRET_VERSION}
|
102
compose.yml
102
compose.yml
@ -1,20 +1,114 @@
|
|||||||
version: "3.8"
|
version: '3.8'
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: "onlyoffice/documentserver:6.3"
|
image: onlyoffice/documentserver:9.0.2
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- rabbitmq
|
||||||
|
stdin_open: true
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- proxy
|
||||||
|
- internal
|
||||||
|
environment:
|
||||||
|
DB_TYPE: postgres
|
||||||
|
DB_HOST: db
|
||||||
|
DB_PORT: 5432
|
||||||
|
DB_NAME: onlyoffice
|
||||||
|
DB_USER: onlyoffice
|
||||||
|
DB_PWD_FILE: /run/secrets/db_password
|
||||||
|
AMQP_URI: amqp://guest:guest@rabbitmq
|
||||||
|
AUTO_ASSEMBLY_ENABLED:
|
||||||
|
AUTO_ASSEMBLY_INTERVAL:
|
||||||
|
AUTO_ASSEMBLY_STEP:
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "-f", "http://localhost/welcome" ]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
|
start_period: 1m
|
||||||
|
configs:
|
||||||
|
- source: entrypoint
|
||||||
|
target: /custom-entrypoint.sh
|
||||||
|
mode: 555
|
||||||
|
entrypoint: /custom-entrypoint.sh
|
||||||
deploy:
|
deploy:
|
||||||
update_config:
|
update_config:
|
||||||
failure_action: rollback
|
failure_action: rollback
|
||||||
order: start-first
|
order: start-first
|
||||||
labels:
|
labels:
|
||||||
|
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=proxy"
|
||||||
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
||||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
|
||||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||||
- coop-cloud.${STACK_NAME}.app.version=6.3-
|
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-fwdproto"
|
||||||
|
- "traefik.http.middlewares.${STACK_NAME}-fwdproto.headers.customRequestHeaders.X-Forwarded-Proto=https"
|
||||||
|
- "coop-cloud.${STACK_NAME}.version=2.11.0+9.0.2"
|
||||||
|
|
||||||
|
rabbitmq:
|
||||||
|
image: rabbitmq:4.1.1
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
healthcheck:
|
||||||
|
test: rabbitmq-diagnostics -q ping
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
|
start_period: 1m
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:9.5
|
||||||
|
deploy:
|
||||||
|
labels:
|
||||||
|
backupbot.backup: "${ENABLE_BACKUPS:-true}"
|
||||||
|
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
||||||
|
backupbot.backup.volumes.db.path: "backup.sql"
|
||||||
|
backupbot.restore.post-hook: '/pg_backup.sh restore'
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: onlyoffice
|
||||||
|
POSTGRES_USER: onlyoffice
|
||||||
|
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/postgresql/data
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "pg_isready", "-U", "onlyoffice" ]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
|
start_period: 1m
|
||||||
|
configs:
|
||||||
|
- source: pg_backup
|
||||||
|
target: /pg_backup.sh
|
||||||
|
mode: 0555
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
proxy:
|
proxy:
|
||||||
external: true
|
external: true
|
||||||
|
internal:
|
||||||
|
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
db_password:
|
||||||
|
external: true
|
||||||
|
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||||
|
|
||||||
|
configs:
|
||||||
|
entrypoint:
|
||||||
|
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
|
||||||
|
file: entrypoint.sh.tmpl
|
||||||
|
template_driver: golang
|
||||||
|
pg_backup:
|
||||||
|
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||||
|
file: pg_backup.sh
|
||||||
|
37
entrypoint.sh.tmpl
Normal file
37
entrypoint.sh.tmpl
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
file_env() {
|
||||||
|
local var="$1"
|
||||||
|
local fileVar="${var}_FILE"
|
||||||
|
local def="${2:-}"
|
||||||
|
|
||||||
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||||
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local val="$def"
|
||||||
|
if [ "${!var:-}" ]; then
|
||||||
|
val="${!var}"
|
||||||
|
elif [ "${!fileVar:-}" ]; then
|
||||||
|
val="$(< "${!fileVar}")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export "$var"="$val"
|
||||||
|
unset "$fileVar"
|
||||||
|
}
|
||||||
|
|
||||||
|
file_env "DB_PWD"
|
||||||
|
file_env "JWT_SECRET"
|
||||||
|
|
||||||
|
CONFIG=/etc/onlyoffice/documentserver/local.json
|
||||||
|
JSON_BIN=/var/www/onlyoffice/documentserver/npm/json
|
||||||
|
JSON="${JSON_BIN} -q -f ${CONFIG}"
|
||||||
|
${JSON} -I -e "if(this.services.CoAuthoring.autoAssembly===undefined)this.services.CoAuthoring.autoAssembly={};"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.autoAssembly.enable = ${AUTO_ASSEMBLY_ENABLED}"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.autoAssembly.interval = '${AUTO_ASSEMBLY_INTERVAL}'"
|
||||||
|
${JSON} -I -e "this.services.CoAuthoring.autoAssembly.step = '${AUTO_ASSEMBLY_STEP}'"
|
||||||
|
|
||||||
|
/app/ds/run-document-server.sh
|
34
pg_backup.sh
Normal file
34
pg_backup.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BACKUP_FILE='/var/lib/postgresql/data/backup.sql'
|
||||||
|
|
||||||
|
function backup {
|
||||||
|
export PGPASSWORD=$(cat /run/secrets/db_password)
|
||||||
|
pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > $BACKUP_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
function restore {
|
||||||
|
cd /var/lib/postgresql/data/
|
||||||
|
restore_config(){
|
||||||
|
# Restore allowed connections
|
||||||
|
cat pg_hba.conf.bak > pg_hba.conf
|
||||||
|
su postgres -c 'pg_ctl reload'
|
||||||
|
}
|
||||||
|
# Don't allow any other connections than local
|
||||||
|
cp pg_hba.conf pg_hba.conf.bak
|
||||||
|
echo "local all all trust" > pg_hba.conf
|
||||||
|
su postgres -c 'pg_ctl reload'
|
||||||
|
trap restore_config EXIT INT TERM
|
||||||
|
|
||||||
|
# Recreate Database
|
||||||
|
psql -U ${POSTGRES_USER} -d postgres -c "DROP DATABASE ${POSTGRES_DB} WITH (FORCE);"
|
||||||
|
createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
|
||||||
|
psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -1 -f $BACKUP_FILE
|
||||||
|
|
||||||
|
trap - EXIT INT TERM
|
||||||
|
restore_config
|
||||||
|
}
|
||||||
|
|
||||||
|
$@
|
18
release/2.0.0+7.1.1
Normal file
18
release/2.0.0+7.1.1
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
This release upgrades onlyoffice to v7, adds a seperate postgresdb + rabbitmq
|
||||||
|
and adds env variables for the forcesave option.
|
||||||
|
|
||||||
|
Please add this to your .env file:
|
||||||
|
|
||||||
|
```
|
||||||
|
SECRET_DB_PASSWORD_VERSION=v1
|
||||||
|
|
||||||
|
AUTO_ASSEMBLY_ENABLED=false
|
||||||
|
AUTO_ASSEMBLY_INTERVAL=5min
|
||||||
|
AUTO_ASSEMBLY_STEP=1min
|
||||||
|
```
|
||||||
|
|
||||||
|
If you like to use the forcesave option, set `AUTO_ASSEMBLY_ENABLED=true`.
|
||||||
|
|
||||||
|
Don't forget to generate or insert a new db secret: `abra app secret generate onlyoffice.example.org db_password v1`
|
||||||
|
|
||||||
|
@yksflip
|
Reference in New Issue
Block a user