Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Christian Galo | a7ff392dd1 | |
Christian Galo | d059b04de0 | |
Christian Galo | 10d66575cf | |
Christian Galo | 826a25edb3 |
41
.drone.yml
41
.drone.yml
|
@ -1,41 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: deploy to swarm-test.autonomic.zone
|
|
||||||
steps:
|
|
||||||
- name: deployment
|
|
||||||
image: git.coopcloud.tech/coop-cloud/stack-ssh-deploy:latest
|
|
||||||
settings:
|
|
||||||
host: swarm-test.autonomic.zone
|
|
||||||
stack: federatedwiki
|
|
||||||
generate_secrets: true
|
|
||||||
purge: true
|
|
||||||
deploy_key:
|
|
||||||
from_secret: drone_ssh_swarm_test
|
|
||||||
networks:
|
|
||||||
- proxy
|
|
||||||
environment:
|
|
||||||
DOMAIN: federatedwiki.swarm-test.autonomic.zone
|
|
||||||
STACK_NAME: federatedwiki
|
|
||||||
LETS_ENCRYPT_ENV: production
|
|
||||||
INSTALL_SH_VERSION: v1
|
|
||||||
CONFIG_JSON_VERSION: v1
|
|
||||||
CONFIG_OWNER_JSON_VERSION: v1
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: generate recipe catalogue
|
|
||||||
steps:
|
|
||||||
- name: release a new version
|
|
||||||
image: plugins/downstream
|
|
||||||
settings:
|
|
||||||
server: https://build.coopcloud.tech
|
|
||||||
token:
|
|
||||||
from_secret: drone_abra-bot_token
|
|
||||||
fork: true
|
|
||||||
repositories:
|
|
||||||
- coop-cloud/auto-recipes-catalogue-json
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event: tag
|
|
26
.env.sample
26
.env.sample
|
@ -1,26 +0,0 @@
|
||||||
TYPE=federatedwiki
|
|
||||||
|
|
||||||
DOMAIN=federatedwiki.example.com
|
|
||||||
## Domain aliases
|
|
||||||
#EXTRA_DOMAINS=', `www.federatedwiki.example.com`'
|
|
||||||
LETS_ENCRYPT_ENV=production
|
|
||||||
|
|
||||||
COMPOSE_FILE="compose.yml"
|
|
||||||
|
|
||||||
# Change to an absolute path to use a bind-mount, e.g. /opt/fedwiki
|
|
||||||
FEDWIKI_VOLUME="fedwiki"
|
|
||||||
|
|
||||||
# custom wiki.cafe image, for working oauth2 support
|
|
||||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.wikicafe.yml"
|
|
||||||
|
|
||||||
# Predefined "owner" security
|
|
||||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.owner.yml"
|
|
||||||
|
|
||||||
# persistent lib volume / node_modules directory, e.g. for plugmatic
|
|
||||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.lib.yml"
|
|
||||||
|
|
||||||
COOKIE_SECRET="asflkjqpweoriuwpeogdjgbpdofigh"
|
|
||||||
AUTHOR="Baja Colorado"
|
|
||||||
ADMIN_KEY="<paste from a .wiki/DOMAIN/status/owner.json file>"
|
|
||||||
|
|
||||||
FEDWIKI_IS_PRIVATE=0
|
|
|
@ -1 +1 @@
|
||||||
/.envrc
|
.env
|
||||||
|
|
40
README.md
40
README.md
|
@ -1,26 +1,24 @@
|
||||||
# Federated Wiki
|
# Fedwiki
|
||||||
|
|
||||||
Share pages circulating within a creative commons
|
Wiki Cafe's configuration for a Nextcloud deployment. Originally slimmed down from an `abra` [recipe](https://git.coopcloud.tech/coop-cloud/federatedwiki) by [Co-op Cloud](https://coopcloud.tech/).
|
||||||
|
|
||||||
<!-- metadata -->
|
|
||||||
* **Category**: Apps
|
|
||||||
* **Status**: 0, work-in-progress
|
|
||||||
* **Image**: [`dobbs/farm`](https://hub.docker.com/r/dobbs/farm/), 4, upstream
|
|
||||||
* **Healthcheck**: No
|
|
||||||
* **Backups**: No
|
|
||||||
* **Email**: No
|
|
||||||
* **Tests**: No
|
|
||||||
* **SSO**: No
|
|
||||||
<!-- endmetadata -->
|
|
||||||
|
|
||||||
## Basic usage
|
## Deploying the app with Docker Swarm
|
||||||
|
|
||||||
1. Set up Docker Swarm and [`abra`]
|
Set the environment variables from the .env file during the shell session.
|
||||||
2. Deploy [`coop-cloud/traefik`]
|
|
||||||
3. `abra app new federatedwiki`
|
|
||||||
4. `abra app config YOURAPPDOMAIN` - be sure to change `DOMAIN` to something that resolves to
|
|
||||||
your Docker swarm box
|
|
||||||
5. `abra app deploy YOURAPPDOMAIN`
|
|
||||||
|
|
||||||
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
```
|
||||||
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
set -a && source .env && set +a
|
||||||
|
```
|
||||||
|
|
||||||
|
Set the secrets.
|
||||||
|
|
||||||
|
```
|
||||||
|
printf "SECRET_HERE" | docker secret create SECRET_NAME -
|
||||||
|
```
|
||||||
|
|
||||||
|
Deploy using the `-c` flag to specify one or multiple compose files.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker stack deploy fedwiki -c compose.yaml -c compose.lib.yaml -c compose.wikicafe.yaml
|
||||||
|
```
|
23
abra.sh
23
abra.sh
|
@ -1,23 +0,0 @@
|
||||||
export INSTALL_SH_VERSION=v9
|
|
||||||
export CONFIG_JSON_VERSION=v7
|
|
||||||
export CONFIG_OWNER_JSON_VERSION=v4
|
|
||||||
|
|
||||||
abra_backup_app() {
|
|
||||||
_abra_backup_dir "app:/home/node/.wiki"
|
|
||||||
}
|
|
||||||
|
|
||||||
abra_restore_app() {
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
{
|
|
||||||
abra__src_="-"
|
|
||||||
abra__dst_="app:/home/node/.wiki"
|
|
||||||
}
|
|
||||||
|
|
||||||
zcat "$@" | sub_app_cp
|
|
||||||
|
|
||||||
success "Restored 'app'"
|
|
||||||
}
|
|
||||||
|
|
||||||
abra_backup() {
|
|
||||||
abra_backup_app
|
|
||||||
}
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
volumes:
|
||||||
|
- "lib:/home/node/lib"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
lib:
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
volumes:
|
|
||||||
- "fedwiki_lib:/home/node/lib"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
fedwiki_lib:
|
|
|
@ -1,15 +0,0 @@
|
||||||
|
|
||||||
---
|
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
configs:
|
|
||||||
- source: config_owner_json_conf
|
|
||||||
target: /home/node/config/config.owner.json
|
|
||||||
|
|
||||||
configs:
|
|
||||||
config_owner_json_conf:
|
|
||||||
name: ${STACK_NAME}_config_owner_json_${CONFIG_OWNER_JSON_VERSION}
|
|
||||||
file: config.owner.json.tmpl
|
|
||||||
template_driver: golang
|
|
|
@ -1,6 +1,3 @@
|
||||||
---
|
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: git.coopcloud.tech/wiki-cafe/wiki-farm:latest
|
image: git.coopcloud.tech/wiki-cafe/wiki-farm:latest
|
|
@ -0,0 +1,71 @@
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: dobbs/farm:1.0.20
|
||||||
|
command: /bin/sh entrypoint.sh
|
||||||
|
volumes:
|
||||||
|
- "data:/home/node/.wiki"
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
configs:
|
||||||
|
- source: entrypoint_sh_conf
|
||||||
|
target: /home/node/entrypoint.sh
|
||||||
|
- source: config_json_initial_conf
|
||||||
|
target: /home/node/initial-config/config.json
|
||||||
|
secrets:
|
||||||
|
- cookie_secret
|
||||||
|
environment:
|
||||||
|
- DOMAIN
|
||||||
|
- COOKIE_SECRET
|
||||||
|
- AUTHOR
|
||||||
|
- ADMIN_KEY
|
||||||
|
deploy:
|
||||||
|
update_config:
|
||||||
|
order: start-first
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=3000"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`) || HostRegexp(`{subdomain:\\w+}.${DOMAIN}`)"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.tls.domains[0].main=${DOMAIN}"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.tls.domains[0].sans=*.${DOMAIN}"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.priority=1"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}_auth.rule=(Host(`${DOMAIN}`) && (PathPrefix(`/auth`) || Path(`/security/dialog.css`)))"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}_auth.entrypoints=web-secure"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}_auth.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||||
|
- "caddy=https://${DOMAIN}, https://*.${DOMAIN}, https://*.*.${DOMAIN}, https://*.*.*.${DOMAIN}"
|
||||||
|
- "caddy.reverse_proxy={{upstreams 3000}}"
|
||||||
|
- "caddy.tls.on_demand="
|
||||||
|
- "backupbot.backup=true"
|
||||||
|
- "backupbot.backup.path=/home/node/.wiki"
|
||||||
|
healthcheck:
|
||||||
|
test: "node -e 'var http = require(\"http\"); var options = { host : \"localhost\", port : \"3000\", timeout : 2000, path : \"/view/welcome-visitors\", headers: { \"Host\": \"${DOMAIN}\" } }; var request = http.request(options, (res)
|
||||||
|
=> { console.log(`STATUS: $${res.statusCode}`); if (res.statusCode == 200) { process.exit(0); } else { process.exit(1); } }); request.on(\"error\", function(err) { console.log('ERROR');
|
||||||
|
process.exit(1); }); request.end();'"
|
||||||
|
interval: 10s
|
||||||
|
timeout: 2s
|
||||||
|
retries: 2
|
||||||
|
start_period: 30s
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
cookie_secret:
|
||||||
|
external: true
|
||||||
|
name: ${STACK_NAME}_cookie_secret
|
||||||
|
|
||||||
|
configs:
|
||||||
|
entrypoint_sh_conf:
|
||||||
|
name: ${STACK_NAME}_entrypoint_sh
|
||||||
|
file: entrypoint.sh
|
||||||
|
config_json_initial_conf:
|
||||||
|
name: ${STACK_NAME}_config_initial_json
|
||||||
|
file: config.initial.json.tmpl
|
||||||
|
template_driver: golang
|
63
compose.yml
63
compose.yml
|
@ -1,63 +0,0 @@
|
||||||
---
|
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
image: dobbs/farm:1.0.18
|
|
||||||
command: /bin/sh config/install.sh
|
|
||||||
volumes:
|
|
||||||
- "fedwiki_friends:/home/node/config"
|
|
||||||
- "${FEDWIKI_VOLUME}:/home/node/.wiki"
|
|
||||||
networks:
|
|
||||||
- proxy
|
|
||||||
configs:
|
|
||||||
- source: install_sh_conf
|
|
||||||
target: /home/node/config/install.sh
|
|
||||||
- source: config_json_conf
|
|
||||||
target: /home/node/config/config.json
|
|
||||||
environment:
|
|
||||||
- DOMAIN
|
|
||||||
- COOKIE_SECRET
|
|
||||||
- AUTHOR
|
|
||||||
- ADMIN_KEY
|
|
||||||
deploy:
|
|
||||||
restart_policy:
|
|
||||||
condition: on-failure
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=3000"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`) || HostRegexp(`{subdomain:\\w+}.${DOMAIN}`)"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.domains[0].main=${DOMAIN}"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.domains[0].sans=*.${DOMAIN}"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.priority=1"
|
|
||||||
- "caddy=https://${DOMAIN}, https://*.${DOMAIN}, https://*.*.${DOMAIN}, https://*.*.*.${DOMAIN}"
|
|
||||||
- "caddy.reverse_proxy={{upstreams 3000}}"
|
|
||||||
- "caddy.tls.on_demand="
|
|
||||||
- "backupbot.backup=true"
|
|
||||||
- "backupbot.backup.path=/home/node/.wiki"
|
|
||||||
- "coop-cloud.${STACK_NAME}.version=1.0.1+1.0.18"
|
|
||||||
# healthcheck:
|
|
||||||
# test: ["CMD", "curl", "-f", "http://localhost"]
|
|
||||||
# interval: 30s
|
|
||||||
# timeout: 10s
|
|
||||||
# retries: 10
|
|
||||||
# start_period: 1m
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
fedwiki:
|
|
||||||
fedwiki_friends:
|
|
||||||
|
|
||||||
networks:
|
|
||||||
proxy:
|
|
||||||
external: true
|
|
||||||
|
|
||||||
configs:
|
|
||||||
install_sh_conf:
|
|
||||||
name: ${STACK_NAME}_install_sh_${INSTALL_SH_VERSION}
|
|
||||||
file: install.sh
|
|
||||||
config_json_conf:
|
|
||||||
name: ${STACK_NAME}_config_json_${CONFIG_JSON_VERSION}
|
|
||||||
file: config.json.tmpl
|
|
||||||
template_driver: golang
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"farm": true,
|
||||||
|
"cookieSecret": "{{ secret "cookie_secret" }}",
|
||||||
|
"secure_cookie": true,
|
||||||
|
"security_type": "friends"
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"admin": "{{ env "ADMIN_KEY" }}",
|
|
||||||
"farm": true,
|
|
||||||
"cookieSecret": "{{ env "COOKIE_SECRET" }}",
|
|
||||||
"secure_cookie": true,
|
|
||||||
"security_type": "friends"
|
|
||||||
{{ if eq (env "FEDWIKI_IS_PRIVATE") "1" }},
|
|
||||||
"wikiDomains": {
|
|
||||||
"$DOMAIN": {
|
|
||||||
"id": "/home/node/.wiki/config.owner.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{ end }}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"name": "{{ env "AUTHOR" }}",
|
|
||||||
"friend": {
|
|
||||||
"secret": "{{ env "PASSWORD" }}"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,8 +4,4 @@ if [ ! -f .wiki/config.json ]; then
|
||||||
cp config/config.json .wiki/config.json
|
cp config/config.json .wiki/config.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f .wiki/config.owner.json ]; then
|
|
||||||
cp config/config.owner.json .wiki/config.owner.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
wiki --farm
|
wiki --farm
|
|
@ -1,7 +0,0 @@
|
||||||
WARNING! 🚨
|
|
||||||
|
|
||||||
There is a new mandatory config option, FEDWIKI_VOLUME -- please copy the
|
|
||||||
default value from the recipe .env.sample to your .env file on upgrade.
|
|
||||||
|
|
||||||
If you haven't done that yet, best to bail with Ctrl+C, then add the option,
|
|
||||||
then re-run this `abra app upgrade ...` command
|
|
Loading…
Reference in New Issue