Added persistent state to tor service

This commit is contained in:
B.J. Dweck 2020-11-02 14:19:56 +02:00
parent ffe167767c
commit 8c02e4f231
2 changed files with 28 additions and 0 deletions

View File

@ -8,6 +8,8 @@ services:
args: args:
- SVC_PORT=${BROKER_MQTT_PORT} - SVC_PORT=${BROKER_MQTT_PORT}
- SVC_HOST=broker - SVC_HOST=broker
volumes:
- tor_config:/var/lib/tor
networks: networks:
- tor_net - tor_net
depends_on: depends_on:
@ -40,6 +42,7 @@ services:
volumes: volumes:
broker_data: broker_data:
client_data: client_data:
tor_config:
networks: networks:
tor_net: tor_net:

25
scripts/tor-vol-migration.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Script to migrate from volume-less tor instance to one that retains
# tor hidden service state (onion url, etc.)
mkdir -p backup/tor
docker cp torch-subscriber-docker_tor_1:/var/lib/tor/svc backup/tor/
docker-compose down
docker-compose up --no-start
docker run --rm \
-v $(pwd)/backup/tor:/backup \
-v torch-subscriber-docker_tor_config:/tor \
ubuntu \
cp -r /backup/svc /tor/
docker run --rm \
-v torch-subscriber-docker_tor_config:/tor \
ubuntu \
chown -R 0:0 /tor
rm -rf backup
docker-compose up -d