(Docker) Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you can create and start all the services from your configuration.
I’m using Docker Compose to run a Hidden Service for the API. The URL is generated internally using (pytor)[https://github.com/cmehay/pytor]. To manage the containers you need to use a bash script called manage (I’m too creative! right?!):
$ bash manage -h
_____ ____ _____ ___ ____
/ ___/ / || |/ _]| \
( \_ | o || __/ [_ | D )
\__ || || |_| _]| /
/ \ || _ || _] [_ | \
\ || | || | | || . \
\___||__|__||__| |_____||__|\_|
------------------------------------------------------------------------
Usage: manage [-h]
Usage: manage [option...] --{init|start|halt|reload|rebuild|clean|onion}
--- MANAGEMENT ---
-i, --init, init Initializes the containers.
-s, --start, start Starts all configured services.
-p, --halt, halt Stops all configured services.
-r, --reload, reload Restart all configured services.
-b, --rebuild, rebuild Rebuild all configured services.
-c, --clean, clean Cleans containers, volumes, images.
--- UTILITIES ---
-o, --onion, onion Get the onion URL.
-h, --help, help Shows this help box.
------------------------------------------------------------------------
*Docker compose should be installed.**
We just need to run: bash manage init
:
...
Creating saferapi ... done
Creating saferhiddenservice ... done
Waiting 20 seconds, tor is booting up...
Finding the .onion URL...
3acgxzofjcd5vnoe262zgnpx7ldotfvlwhiia7g7i6g7vgywosfmffqd.onion
Adding an upload function to your .bash_profile file...
Adding a download function to your .bash_profile file...
Done. Remember to do: source ~/.bash_profile
Now 2 functions were created: upload
and download
. Also we can access the url using Tor Browser to confirm if the containers are running:
We just need to pass 2 parameters, the path and the password to generate the key; for example we’re going to upload the docker-compose.yml file:
$ upload docker-compose.yml password1234
Uploading file...
{"id": 2, "key": "AHWRnPCEwnaKPfezcEnBl6dZ0DeHx9j55DeB-Ur405g="}
Done.
Now we have an id
and a key
that we’re going to use to download the file.
With the id
and the key
we can download the file like this:
$ download 2 "AHWRnPCEwnaKPfezcEnBl6dZ0DeHx9j55DeB-Ur405g\=" docker-compose.decrypted.yml
Downloading file...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 603 100 420 100 183 372 162 0:00:01 0:00:01 --:--:-- 373
$ ls -lh
...
-rw-r--r-- 1 davidtavarez staff 420B Jul 22 23:18 docker-compose.decrypted.yml
-rw-r--r-- 1 davidtavarez staff 420B Jul 21 14:17 docker-compose.yml
...
It works perfectly!
Well, I think this is a pretty simple and fast solution for storing some important and personal files. I truly recommend to run the service on an encrypted disk. Try it by yourself using this link: safer. Feel free to open an issue if you found something; also I would love some contributions too.
Stay safe!