Init docker-compose.yml and add documentation

for initial deployment and updates
This commit is contained in:
teutat3s 2022-11-27 23:25:55 +01:00
parent 35e5dfa9a3
commit 05d168c5d1
Signed by: teutat3s
GPG key ID: 18DAE600A6BBE705
2 changed files with 64 additions and 0 deletions

View file

@ -9,3 +9,46 @@ The dockerfile builds a container that uses [feed2toot](https://feed2toot.readth
* `feed2toot_usercred.txt`: from `register_feed2toot_app` script * `feed2toot_usercred.txt`: from `register_feed2toot_app` script
* `feed2toot_cache.db`: cache file to register previous posts * `feed2toot_cache.db`: cache file to register previous posts
Docker image was built like this and pushed to registry:
```
docker build -t registry.greenbaum.cloud/library/mastodon-hackernews-feed2toot:0.0.1 .
docker push registry.greenbaum.cloud/library/mastodon-hackernews-feed2toot:0.0.1
```
Initial deployment, just for documentation, **don't run this for updates**:
```
# Run the steps from Deployment of updates section
# After initial deployment, copy secrets and cache file to volume mounted on /data
find . -name 'feed2toot*' -type f
./feed2toot.ini
./secrets/feed2toot_clientcred.txt
./secrets/feed2toot_cache.db
./secrets/feed2toot_usercred.txt
for FILE in $(find . -name 'feed2toot*' -type f -printf "%f\n"); \
do \
docker cp ./secrets/$FILE bot_mastodon-hackernews-feed2toot_1:/data/$FILE; \
done
docker cp ./feed2toot.ini bot_mastodon-hackernews-feed2toot_1:/data/feed2toot.ini
# Uncomment external option of volume
```
Deployment of updates:
1. Get [tritonshell](https://git.greenbaum.cloud/dev/tritonshell)
2. Enter `tritonshell` for DC `cgn-1`
```
cd tritonshell
nix develop --command $SHELL
eval "$(triton env cgn-1-pub_solar)"
cd ..
# Optional
# Check for running container
docker ps -a | grep mastodon-hackernews-feed2toot
```
3. Update running container to a new version
```
docker-compose --project-name bot up --detach
```

21
docker-compose.yml Normal file
View file

@ -0,0 +1,21 @@
version: "2.4"
services:
mastodon-hackernews-feed2toot:
image: registry.greenbaum.cloud/library/mastodon-hackernews-feed2toot:0.0.1
mem_limit: 128m
restart: always
network_mode: My-Fabric-Network
volumes:
- mastodon-hackernews-feed2toot:/data
volumes:
mastodon-hackernews-feed2toot:
# Uncomment this after volume creation
external: true
name: mastodon-hackernews-feed2toot
driver: tritonnfs
driver_opts:
size: "10G"
labels:
- volumename=mastodon-hackernews-feed2toot