rss-to-activity-pub dockerized
- Clone the
rss-to-activity-pub
repository and move into it :From now on all commands have to be executed in this directory.$ git clone https://github.com/dariusk/rss-to-activitypub && cd rss-to-activitypub
- Clone the
rss-to-activity-pub-docker
repository a folder nameddocker
:$ git clone https://framagit.org/husimo/rss-to-activity-pub-docker docker
- Optional - if you want to compile on another platform, in
docker/Dockerfile
:- First line, replace
node:alpine
byarm32v6/node:alpine
forarm32v6
platform (ex: Raspberry Pi). - First line
node:alpine
byarm64v8/node:alpine
forarm64v8
platform (ex: Scaleway ARM)
- First line, replace
- Compile the image, be sure to be in
rss-to-activity-pub
root directory to provide the good context (source code) to Docker build. Note that red warnings will be displayed on screen as result of node compilation.You should have that output at the end :$ sudo docker build -f docker/Dockerfile -t rss-to-activity-pub .
Successfully built xxxxxxxxxx Successfully tagged rss-to-activity-pub:latest
- Create the data directory in docker folder. All application data will be stored there.
$ mkdir docker/data
- Next, you have two choices.
- If you don't use any reverse proxy.
- copy the
docker-compose.yml.dist
file todocker-compose.yml
and open it :$ cp docker/docker-compose.yml.dist docker/docker-compose.yml && nano docker/docker-compose.yml
- At the line
- DOMAIN=mydomain.tld
you have to replacemydomain.tld
by your domain name. - Optional (not tested) - if you provide a SSL certificate, you have to :
- Put your key and certificate in
docker/data
folder. - Uncomment
# volumes:
and# - "443:443"
lines. - Line
# - PRIVKEY_PATH=/app/privkey_path
replaceprivkey_path
by the name of you private key file with its extension and uncomment the line. - Line
# - ./data/privkey_path:/app/privkey_path
replaceprivkey_path
by the name of you private key file with its extension and uncomment the line. - Line
# - CERT_PATH=/app/cert_path
replacecert_path
by the name of you certificate file with its extension and uncomment the line. - Line
# - ./data/cert_path:/app/cert_path
replacecert_path
by the name of you certificate file with its extension and uncomment the line.
- Put your key and certificate in
- Optional - if you want to override HTTP or HTTPS port, you have to replace the previous one by yours.
- Optional - if you want to disable HTTP, just comment the line ` - "80:80".
- Don't uncomment
# - ./data/bot-node.db:/app/bot-node.db
, we'll do it a bit later, once the container is started.
- copy the
- If you use traefik proxy as your reverse proxy. If you use another reverse proxy, sorry, you're on your own.
- Copy
docker-compose-traefik.yml.dist
file todocker-compose.yml
and open it :$ cp docker/docker-compose-traefik.yml.dist docker/docker-compose.yml && nano docker/docker-compose.yml
- You have to replace multiple occurencies of mydomain.tld in the file by your domain.
- If you traefik-proxy is not named
traefik-proxy
, you must replace all occurencies of it with yours in the file. - Don't uncomment
# - ./data/bot-node.db:/app/bot-node.db
nor# volumes:
, we'll do it a bit later, one the container is started.
- Copy
- If you don't use any reverse proxy.
- Start you container using that command and display the log :
$ sudo docker-compose -f docker/docker-compose.yml up -d && sudo docker-compose -f docker/docker-compose.yml logs -f
- Once you have
Express server listening on port XXXX
, you can type [Ctrl+C] to quit the log command. If not, you may have missed a step. - In order to persist your database you now have to save the sqlite3 database created in the first execution of the container in your machine filesystem. Execute the following command :
$ sudo docker exec rss-to-activity-pub cat /app/bot-node.db > docker/data/bot-node.db
- In
docker/docker-compose.yml
, you have to :- Uncomment
# - ./data/bot-node.db:/app/bot-node.db
- If it's not already the case, uncomment
# volumes:
too.
- Uncomment
- Finally, recreate your container which will have the database persisted :
You should be able to access to your rss-to-activity-pub instance at your chosen domain adress.
$ sudo docker-compose -f docker/docker-compose.yml up -d
- One of the last thing you need to do is create a regular task to update the feeds :
Select nano if a choice is asked. Add the following line :
$ sudo crontab -e
Your feeds will be updated every 10 minutes.*/1 * * * * docker exec rss-to-activity-pub /bin/sh -c "cd /app && node queueFeeds.js" >/dev/null 2>&1
- Also it is recommended to create at the root of rss-to-activity-pub directory a file named
.dockerignore
which containsdocker/data
. Without it, your db file would be included next time you build the image with an image significally heavier for nothing (db file is mounted from docker-compose.yml).
- Go to you rss-to-activity-pub directory and then do
git pull
for getting the new version of code. - Then go to to the docker diretory and do the same thing :
git pull
- On the root of rss-to-activity-pub directory, execute
sudo docker build -f docker/Dockerfile -t rss-to-activity-pub .
to build the new image using the newly downloaded version of code. Be sure to note 13th step of "First time" above. - Execute
sudo docker-compose -f docker/docker-compose.yml up -d
to create updated container.