This buildpack sets up a Tor v3 onion service for your application on Heroku. v2 will be disabled later in 2021.
I will be regularly and manually updating the Tor version, which may require you to clear your build cache upon your next git push for your application when I do so. Easy instructions can be found here.
This is so that we get to stay current with Tor's bugfixes and patches.
This buildpack has a specific hobbyist use case, and is not intended for any use involving gravely serious requirements of anonymity. If you must use Tor for such a reason, please look into other ways of deploying web apps onto the dark web.
-
Install the buildpack like you would with any other buildpack
-
Modify your
Procfile
as follows:web: ./tor/bin/run_tor & <your-usual-dyno-cmd>
-
Deploy your application
-
Run
heroku logs --tail
to see the.onion
address you generated; with this setup the address will change with each redeploy, but the next section will explain how to set up a persistent address
- Obtain the following files for a
.onion
address by using mkp224ohostname
hs_ed25519_public_key
hs_ed25519_secret_key
- Create a new environment variable for your application in Heroku
- Key:
ONION_LOCATION
- Value: the
.onion
address inside thehostname
file
- Key:
- Create a
config
directory in your application's root folder - Copy and paste your
hs_ed25519_public_key
andhs_ed25519_secret_key
files into this newconfig
directory - Create a
torrc.erb
file in theconfig
directory and ensureHiddenServiceDir
has the value/app/onion-service/
(example) - Modify your
Procfile
as outlined in the previous section if you haven't yet done so - Deploy your application
The free .herokuapp.com
domain automatically redirects to HTTPS, which will normally break your visit to your onionsite, but you can use a custom port to circumvent this.
Add the following to your torrc.erb
(referred to above):
HiddenServicePort <pick-a-port> 127.0.0.1:<your-port>
Your onionsite should then be available at yourv3onionaddress.onion:your-port
If you get stuck, please defer to jtschoonhoven's fork or associated Medium story for a much more in-depth tutorial. Most of the instructions apply except for the private_key ones specific to v2 .onion addresses, which I've updated for v3 .onion
addresses here.