From dd8755658d9543acad87ab4064bf5e0db86597e4 Mon Sep 17 00:00:00 2001 From: poma Date: Fri, 6 Dec 2019 02:08:54 +0700 Subject: [PATCH] add docker readme --- .env.example | 2 +- .gitignore | 4 +++- README.md | 18 +++++++++++++++++- docker-compose.yml | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 docker-compose.yml diff --git a/.env.example b/.env.example index a5d62f3..3c5716c 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ NET_ID=42 -RPC_URL=https://kovan.infura.io/v3/a3f4d001c1fc4a359ea70dd27fd9cb51 +RPC_URL=https://kovan.infura.io PRIVATE_KEY= # 2.5 means 2.5% RELAYER_FEE=2.5 diff --git a/.gitignore b/.gitignore index d06a9ff..007b86c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .vscode node_modules/ -.env \ No newline at end of file +.env +.env.mainnet +.env.kovan \ No newline at end of file diff --git a/README.md b/README.md index 2bfb9ac..99824c5 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,27 @@ Relayer should return a transaction hash. *Note.* If you want to change contracts' addresses go to [config.js](./config.js) file. -## Deploy as a Docker container +## Deploy with docker-compose + +docker-compose.yml contains a stack that will automatically provision SSL certificates for your domain name and will add a https redirect to port 80. + +1. Download docker-compose.yml +2. Change environment variables for `kovan` containers as appropriate + * add `PRIVATE_KEY` for your relayer address + * set `VIRTUAL_HOST` and `LETSENCRYPT_HOST` to your domain and add DNS record pointing to your relayer ip address + * customize `RELAYER_FEE` + * update `RPC_URL` if needed +3. Run `docker-compose up -d` + +## Run as a Docker container + 1. `cp .env.example .env` 2. Modify `.env` as needed 3. `docker run -d --env-file .env -p 80:8000 tornadocash/relayer` +In that case you will need to add https termination yourself because browsers with default settings will prevent https +tornado.cash UI from submitting your request over http connection + ## Input data example ```json { diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..92f14e4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '2' +services: + kovan: + image: tornadocash/relayer + restart: always + env_file: ./.env.kovan + environment: + VIRTUAL_HOST: example.duckdns.org + LETSENCRYPT_HOST: example.duckdns.org + NET_ID: 42 + RPC_URL: https://kovan.infura.io + PRIVATE_KEY: + # 2.5 means 2.5% + RELAYER_FEE: 2.5 + nginx: + image: jwilder/nginx-proxy + restart: always + ports: + - 80:80 + - 443:443 + volumes: + - /etc/nginx/certs + - /etc/nginx/vhost.d + - /usr/share/nginx/html + - /var/run/docker.sock:/tmp/docker.sock:ro + letsencrypt: + image: jrcs/letsencrypt-nginx-proxy-companion + restart: always + volumes_from: + - nginx + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro \ No newline at end of file