forked from coop-cloud/federatedwiki
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
118fea84de |
+15
@@ -0,0 +1,15 @@
|
|||||||
|
TYPE=federatedwiki
|
||||||
|
|
||||||
|
DOMAIN=federatedwiki.example.com
|
||||||
|
## Domain aliases
|
||||||
|
#EXTRA_DOMAINS=', `www.federatedwiki.example.com`'
|
||||||
|
LETS_ENCRYPT_ENV=production
|
||||||
|
|
||||||
|
# Predefined "owner" security
|
||||||
|
#COMPOSE_FILE="compose.yml:compose.owner.yml"
|
||||||
|
|
||||||
|
COOKIE_SECRET="asflkjqpweoriuwpeogdjgbpdofigh"
|
||||||
|
AUTHOR="Baja Colorado"
|
||||||
|
ADMIN_KEY="<paste from a .wiki/DOMAIN/status/owner.json file>"
|
||||||
|
|
||||||
|
FEDWIKI_IS_PRIVATE=0
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
.env*
|
/.envrc
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
# Fedwiki
|
# Federated Wiki
|
||||||
|
|
||||||
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/).
|
Share pages circulating within a creative commons
|
||||||
|
|
||||||
|
<!-- metadata -->
|
||||||
|
* **Category**: Apps
|
||||||
|
* **Status**: ❹💣
|
||||||
|
* **Image**: [`dobbs/farm`](https://hub.docker.com/r/dobbs/farm/), ❶💚, upstream
|
||||||
|
* **Healthcheck**: No
|
||||||
|
* **Backups**: No
|
||||||
|
* **Email**: No
|
||||||
|
* **Tests**: No
|
||||||
|
* **SSO**: No
|
||||||
|
<!-- endmetadata -->
|
||||||
|
|
||||||
## Deploying the app with Docker Swarm
|
## Basic usage
|
||||||
|
|
||||||
Set the environment variables from the .env file during the shell session.
|
1. Set up Docker Swarm and [`abra`]
|
||||||
|
2. Deploy [`coop-cloud/traefik`]
|
||||||
|
3. `abra app new federatedwiki`
|
||||||
|
4. `abra app YOURAPPDOMAIN config` - be sure to change `DOMAIN` to something that resolves to
|
||||||
|
your Docker swarm box
|
||||||
|
5. `abra app YOURAPPDOMAIN deploy`
|
||||||
|
|
||||||
```
|
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
||||||
set -a && source .env && set +a
|
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
||||||
```
|
|
||||||
|
|
||||||
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 --detach=true -c compose.yaml
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
export INSTALL_SH_VERSION=v8
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
services:
|
|
||||||
app:
|
|
||||||
volumes:
|
|
||||||
- "lib:/home/node/lib"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
lib:
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
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,74 +0,0 @@
|
|||||||
services:
|
|
||||||
app:
|
|
||||||
image: git.coopcloud.tech/wiki-cafe/fedwiki-oci-image:0.41.1-3
|
|
||||||
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
|
|
||||||
- DOMAINS
|
|
||||||
- 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_0=https://${DOMAIN}"
|
|
||||||
- "caddy_0.tls.on_demand="
|
|
||||||
- "caddy_0.@match.path=/auth/* /security/*"
|
|
||||||
- "caddy_0.reverse_proxy= @match {{upstreams 3000}}"
|
|
||||||
- ${DOMAINS}
|
|
||||||
- "caddy_1.reverse_proxy={{upstreams 3000}}"
|
|
||||||
- "caddy_1.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
|
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: dobbs/farm
|
||||||
|
command: /bin/sh config/install.sh
|
||||||
|
volumes:
|
||||||
|
- "fedwiki_friends:/home/node/config"
|
||||||
|
- "fedwiki:/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}"
|
||||||
|
# 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
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"farm": true,
|
|
||||||
"cookieSecret": "{{ secret "cookie_secret" }}",
|
|
||||||
"security_useHttps": true,
|
|
||||||
"security_type": "friends"
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"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 }}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "{{ env "AUTHOR" }}",
|
||||||
|
"friend": {
|
||||||
|
"secret": "{{ env "PASSWORD" }}"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ ! -f .wiki/config.json ]; then
|
|
||||||
cp config/config.json .wiki/config.json
|
|
||||||
fi
|
|
||||||
|
|
||||||
wiki --farm
|
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
npm install wiki-plugin-plugmatic
|
||||||
|
|
||||||
|
if [ ! -f .wiki/config.json ]; then
|
||||||
|
cp config/config.json .wiki/config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f .wiki/config.owner.json ]; then
|
||||||
|
cp config/config.owner.json .wiki/config.owner.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
wiki --farm --security_type=friends
|
||||||
Reference in New Issue
Block a user