Compare commits
4 commits
bfc3d953a0
...
05d168c5d1
Author | SHA1 | Date | |
---|---|---|---|
05d168c5d1 | |||
35e5dfa9a3 | |||
a72c62b7d5 | |||
8ab8a5523b |
8 changed files with 212 additions and 1 deletions
4
.envrc
Normal file
4
.envrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
# reload when these files change
|
||||
cd tritonshell
|
||||
watch_file flake.nix
|
||||
use_flake
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
secrets
|
||||
tags
|
43
README.md
43
README.md
|
@ -9,3 +9,46 @@ The dockerfile builds a container that uses [feed2toot](https://feed2toot.readth
|
|||
* `feed2toot_usercred.txt`: from `register_feed2toot_app` script
|
||||
* `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
21
docker-compose.yml
Normal 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
|
|
@ -4,7 +4,7 @@ instance_url=https://mastodon.pub.solar
|
|||
user_credentials=/data/feed2toot_usercred.txt
|
||||
client_credentials=/data/feed2toot_clientcred.txt
|
||||
; Default visibility is public, but you can override it:
|
||||
; toot_visibility=unlisted
|
||||
toot_visibility=unlisted
|
||||
|
||||
[cache]
|
||||
cachefile=/data/feed2toot_cache.db
|
||||
|
|
2
tritonshell/.gitignore
vendored
Normal file
2
tritonshell/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.direnv
|
||||
result
|
95
tritonshell/flake.lock
generated
Normal file
95
tritonshell/flake.lock
generated
Normal file
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
"nodes": {
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667210711,
|
||||
"narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1669411043,
|
||||
"narHash": "sha256-LfPd3+EY+jaIHTRIEOUtHXuanxm59YKgUacmSzaqMLc=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5dc7114b7b256d217fe7752f1614be2514e61bb8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"tritonshell-module": "tritonshell-module"
|
||||
}
|
||||
},
|
||||
"tritonshell-module": {
|
||||
"inputs": {
|
||||
"devshell": [
|
||||
"devshell"
|
||||
],
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1669581047,
|
||||
"narHash": "sha256-qs2VUUCCkWlc+5KvP/Vh2ToLKMkCjAws47bVT6rilG8=",
|
||||
"ref": "main",
|
||||
"rev": "341aa68b667a8fb9b77f8af319b7439e82c78793",
|
||||
"revCount": 53,
|
||||
"type": "git",
|
||||
"url": "https://git.greenbaum.cloud/dev/tritonshell"
|
||||
},
|
||||
"original": {
|
||||
"ref": "main",
|
||||
"type": "git",
|
||||
"url": "https://git.greenbaum.cloud/dev/tritonshell"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
44
tritonshell/flake.nix
Normal file
44
tritonshell/flake.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
description = "Example devshell using the tritonshell nix module";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
devshell.url = "github:numtide/devshell";
|
||||
devshell.inputs.flake-utils.follows = "flake-utils";
|
||||
devshell.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
tritonshell-module.url = "git+https://git.greenbaum.cloud/dev/tritonshell?ref=main";
|
||||
tritonshell-module.inputs.devshell.follows = "devshell";
|
||||
tritonshell-module.inputs.flake-utils.follows = "flake-utils";
|
||||
tritonshell-module.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, flake-utils, devshell, tritonshell-module, nixpkgs }:
|
||||
flake-utils.lib.simpleFlake {
|
||||
inherit self nixpkgs;
|
||||
name = "infra-project";
|
||||
preOverlays = [ devshell.overlay ];
|
||||
shell = { pkgs }:
|
||||
pkgs.devshell.mkShell {
|
||||
imports = [ tritonshell-module.devshellModules.x86_64-linux.tritonshell ];
|
||||
# Now the tritonshell environment nix module options are available
|
||||
environment = {
|
||||
enable = true;
|
||||
# CUSTOMIZE if desired, default options are:
|
||||
#cnsBaseDomain = "greenbaum.zone";
|
||||
#dataCenters = [ "cgn-1" "lev-1" ];
|
||||
#mantaDomain = "eu-central.manta.greenbaum.cloud";
|
||||
#tritonApiDomain = "api.greenbaum.cloud";
|
||||
};
|
||||
|
||||
# Add additional packages you'd like to be available in your devshell
|
||||
# PATH here
|
||||
devshell.packages = with pkgs; [
|
||||
#nodejs
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue