Skip to content

Commit 604db3a

Browse files
committed
deploy & upgrade test results
1 parent 0c5e5b2 commit 604db3a

File tree

4 files changed

+51
-15
lines changed

4 files changed

+51
-15
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
*.env
1+
*.env*
22
data
33
redis

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ DCAPE_TAG ?= dcape
2222
DCAPE_NET ?= $(DCAPE_TAG)
2323
PG_CONTAINER ?= $(DCAPE_TAG)_db_1
2424
APP_ROOT ?= $(PWD)
25+
REDIS_PASS ?= $(shell < /dev/urandom tr -dc A-Za-z0-9 2>/dev/null | head -c8; echo)
2526
DC_VER ?= latest
2627

2728
define CONFIG_DEF
@@ -52,6 +53,7 @@ PGUSER=$(PGUSER)
5253
# Database user password
5354
PGPASSWORD=$(PGPASSWORD)
5455
# Database dump for import on create
56+
# Used as ${PG_DUMP_SOURCE}.{tar|tgz}
5557
PG_DUMP_SOURCE=$(PG_DUMP_SOURCE)
5658

5759
# Docker details
@@ -69,6 +71,9 @@ DCAPE_NET=$(DCAPE_NET)
6971
# dcape postgresql container name
7072
PG_CONTAINER=$(PG_CONTAINER)
7173

74+
# Redis access password
75+
REDIS_PASS=$(REDIS_PASS)
76+
7277
# Nextcloud image name
7378
IMAGE=$(IMAGE)
7479
# Redis image name
@@ -137,14 +142,17 @@ docker-wait:
137142

138143
# Database import script
139144
# DCAPE_DB_DUMP_DEST must be set in pg container
140-
145+
# zcat pipe may cause "terminated by signal 13" error, so .tar is also supported
141146
define IMPORT_SCRIPT
142147
[ "$$DCAPE_DB_DUMP_DEST" ] || { echo "DCAPE_DB_DUMP_DEST not set. Exiting" ; exit 1 ; } ; \
143148
DB_NAME="$$1" ; DB_USER="$$2" ; DB_PASS="$$3" ; DB_SOURCE="$$4" ; \
144-
dbsrc=$$DCAPE_DB_DUMP_DEST/$$DB_SOURCE.tgz ; \
145-
if [ -f $$dbsrc ] ; then \
146-
echo "Dump file $$dbsrc found, restoring database..." ; \
147-
zcat $$dbsrc | PGPASSWORD=$$DB_PASS pg_restore -h localhost -U $$DB_USER -O -Ft -d $$DB_NAME || exit 1 ; \
149+
dbsrc=$$DCAPE_DB_DUMP_DEST/$$DB_SOURCE ; \
150+
if [ -f $${dbsrc}.tgz ] ; then \
151+
echo "Dump file $${dbsrc}.tgz found, restoring database..." ; \
152+
zcat $${dbsrc}.tgz | PGPASSWORD=$$DB_PASS pg_restore -h localhost -U $$DB_USER -O -Ft -d $$DB_NAME || exit 1 ; \
153+
elif [ -f $${dbsrc}.tar ] ; then \
154+
echo "Dump file $${dbsrc}.tar found, restoring database..." ; \
155+
PGPASSWORD=$$DB_PASS pg_restore -h localhost -U $$DB_USER -O -d $$DB_NAME $${dbsrc}.tar || exit 1 ; \
148156
else \
149157
echo "Dump file $$dbsrc not found" ; \
150158
exit 2 ; \
@@ -161,8 +169,8 @@ db-create: docker-wait
161169
docker exec -i $$PG_CONTAINER psql -U postgres -c "CREATE DATABASE \"$$PGDATABASE\" OWNER \"$$PGUSER\";" 2>&1 > .psql.log | grep "already exists" > /dev/null || db_exists=1 ; \
162170
cat .psql.log ; rm .psql.log ; \
163171
if [ "$$db_exists" = "1" ] ; then \
164-
echo "*** db data load" ; \
165172
if [ "$$PG_DUMP_SOURCE" ] ; then \
173+
echo "*** db data load" ; \
166174
echo "$$IMPORT_SCRIPT" | docker exec -i $$PG_CONTAINER bash -s - $$PGDATABASE $$PGUSER $$PGPASSWORD $$PG_DUMP_SOURCE \
167175
&& docker exec -i $$PG_CONTAINER psql -U postgres -c "COMMENT ON DATABASE \"$$PGDATABASE\" IS 'SOURCE $$PG_DUMP_SOURCE';" \
168176
|| true ; \

README.md

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ nextcloud.com application package for dcape
2727

2828
## Usage
2929

30+
31+
* Gitea: Fork or mirror this repo in your Git service
32+
* Drone: Activate repo
33+
* Gitea: Run "Test delivery", config sample will be saved to enfist
34+
* Enfist: Edit config and remove .sample from name
35+
* Run "Test delivery" again (app will be installed and started on webhook host)
36+
3037
### Redis
3138
```
3239
sysctl vm.overcommit_memory=1
@@ -39,17 +46,36 @@ config/config.php:
3946
'overwriteprotocol' => 'https',
4047
```
4148

42-
* Fork this repo in your Git service
43-
* Setup deploy hook
44-
* Run "Test delivery" (config sample will be created in dcape)
45-
* Edit and save config (enable deploy etc)
46-
* Run "Test delivery" again (app will be installed and started on webhook host)
47-
* Fork [dopos/dcape-dns-config](https://github/com/dopos/dcape-dns-config) and cook your zones
49+
## Upgrade
50+
51+
#### v17 -> v18
52+
53+
* IMAGE_VER=18.0.11-apache
54+
* В каталоге data развернуть из старой версии config,data
55+
* поднять БД из дампа
56+
* chown -R 32:101 data
57+
* `make up` - остальное в data появится
58+
* `make dc CMD="run --rm -u www-data cloud-app php occ upgrade"`
59+
* Ошибка "Column name "oc_flow_operations"."entity" is NotNull, but has empty string or null as default.".
60+
Решение: `ALTER TABLE oc_flow_operations ADD COLUMN entity VARCHAR NOT NULL;` и повторить обновление
61+
62+
#### v18 -> v19
63+
64+
* IMAGE_VER=19.0.5-fpm-alpine
65+
* chown -R 82:101 data
66+
* `make up`
67+
68+
#### v19 -> v20
4869

49-
See also: [Deploy setup](https://github.com/dopos/dcape/blob/master/DEPLOY.md) (in Russian)
70+
* IMAGE_VER=20.0.3-fpm-alpine
71+
* `make up`
72+
* chown -R 82:101 data
73+
* `make dc CMD="run --rm -u www-data cloud-app php occ maintenance:mode --off"`
74+
* открываем /settings/admin/overview - там напишут, какие команды еще запустить
75+
* в одном месте все может отвалиться из-за подтверждения. Решение: `make dc CMD="run --rm -u www-data cloud-app php occ db:convert-filecache-bigint --no-interaction"`
5076

5177
## License
5278

5379
The MIT License (MIT), see [LICENSE](LICENSE).
5480

55-
Copyright (c) 2019 Aleksei Kovrizhkin <lekovr+dopos@gmail.com>
81+
Copyright (c) 2019-2020 Aleksei Kovrizhkin <lekovr+dopos@gmail.com>

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ services:
4444
- NEXTCLOUD_ADMIN_PASSWORD=${USER_PASS}
4545
- NEXTCLOUD_TRUSTED_DOMAINS=${APP_SITE}
4646
- REDIS_HOST=cloud-cache
47+
- REDIS_HOST_PASSWORD=${REDIS_PASS}
4748

4849
cloud-cache:
4950
image: ${REDIS_IMAGE}:${REDIS_IMAGE_VER}
5051
restart: always
52+
command: redis-server --requirepass ${REDIS_PASS}
5153
# sysctls:
5254
# net.core.somaxconn: 511
5355
networks:

0 commit comments

Comments
 (0)