first commit

This commit is contained in:
giles bradshaw 2024-02-11 12:31:51 +00:00
commit 7bcd640ef3
9 changed files with 172 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.email
.db-password
.db-root-password

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM ghost:alpine
RUN apk update && apk add gettext
COPY config.production.template /var/lib/ghost/
COPY run.sh .
CMD ["sh", "./run.sh"]

56
README.md Normal file
View File

@ -0,0 +1,56 @@
# Village hall website
This is the configuration for the **docker stack** running village hall web site.
Served by a reverse proxy running on another docker stack.
## secrets
you need to put secrets in the following files
### .email
```
{
"transport": "SMTP",
"options":
{
"service": "Mailgun",
"host": "smtp.eu.mailgun.org",
"secure": true,
"port": 465,
"auth": {
"user": "[secret!!]",
"pass": "[secret!]"
}
}
}
```
### .db-password
```
[secret!]
```
### .db-root-password
```
[secret!]
```
## build
```sh
sh build.sh
```
## deploy
```sh
sh deploy.sh
```

1
build.sh Normal file
View File

@ -0,0 +1 @@
docker build . -t rose-ash-ghost

20
config.development.json Normal file
View File

@ -0,0 +1,20 @@
{
"url": "http://localhost:2368",
"server": {
"port": 2368,
"host": "::"
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/lib/ghost/content"
}
}

View File

@ -0,0 +1,27 @@
{
"url": "http://localhost:2368",
"server": {
"port": 2368,
"host": "::"
},
"mail": $EMAIL,
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/lib/ghost/content"
},
"database": {
"client": "mysql",
"connection": {
"host": "db",
"user": "ghost",
"password": "$DBPASSWORD",
"database": "ghostdb"
}
}
}

3
deploy.sh Normal file
View File

@ -0,0 +1,3 @@
docker stack rm rose-ash
for i in 1 2 3 4 5 6 7 8 9 10; do sleep 5 && docker stack deploy -c docker-compose.yml rose-ash && break ; done

51
docker-compose.yml Normal file
View File

@ -0,0 +1,51 @@
version: "3.3"
services:
ghost:
image: rose-ash-ghost:latest
depends_on:
- db
environment:
url: https://sigyl.com:4000/
NODE_ENV: production
volumes:
- ghost-content:/var/lib/ghost/content
networks:
- appnet
- externalnet
secrets:
- email
- db-password
db:
image: mariadb:latest
environment:
FILE__MYSQL_ROOT_PASSWORD: /run/secrets/db-root-password
MYSQL_USER: ghost
FILE__MYSQL_PASSWORD: /run/secrets/db-password
MYSQL_DATABASE: ghostdb
volumes:
- ghost-db:/var/lib/mysql
networks:
- appnet
secrets:
- db-password
- db-root-password
volumes:
ghost-content:
ghost-config:
ghost-db:
networks:
appnet:
driver: overlay
externalnet:
driver: overlay
external: true
secrets:
email:
file: ./.email
db-password:
file: ./.db-password
db-root-password:
file: ./.db-root-password

5
run.sh Normal file
View File

@ -0,0 +1,5 @@
export EMAIL=$(cat /run/secrets/email)
export DBPASSWORD=$(cat /run/secrets/db-password)
envsubst < /var/lib/ghost/config.production.template > /var/lib/ghost/config.production.json
cat /var/lib/ghost/config.production.json
node current/index.js