From d6a1ff60307bef81faa6674a0a054430a420153c Mon Sep 17 00:00:00 2001 From: tecnovert Date: Sun, 14 Feb 2021 15:06:46 +0200 Subject: [PATCH] docker: Set timezone in TZ env var. --- Dockerfile | 2 +- basicswap/basicswap.py | 1 + doc/install.md | 16 ++++++++++++---- docker/.env | 1 + docker/docker-compose.yml | 2 ++ docker/production/.env | 1 + docker/production/docker-compose.yml | 2 ++ docker/production/swapclient/Dockerfile | 2 +- 8 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index acbf94a..e18cb3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV LANG=C.UTF-8 \ DATADIRS="/coindata" RUN apt-get update; \ - apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config gosu; + apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config gosu tzdata; RUN wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/anonswap.zip && \ unzip coincurve-anonswap.zip && \ diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index e396c22..636c4d8 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -715,6 +715,7 @@ class BasicSwap(BaseApp): def start(self): self.log.info('Starting BasicSwap %s, database v%d\n\n', __version__, self.db_version) self.log.info('sqlalchemy version %s', sa.__version__) + self.log.info('timezone offset: %d (%s)', time.timezone, time.tzname[0]) self.upgradeDatabase(self.db_version) diff --git a/doc/install.md b/doc/install.md index 8e2cc03..4ff13b3 100644 --- a/doc/install.md +++ b/doc/install.md @@ -13,12 +13,14 @@ Docker must be installed and started: Should return a line containing `active (running)` -Create the images: +#### Create the images: $ cd basicswap/docker $ docker-compose build -Prepare the datadir: + +#### Prepare the datadir: + Set XMR_RPC_HOST and BASE_XMR_RPC_PORT to a public XMR node or exclude to run a local node. Set xmrrestoreheight to the current xmr chain height. Adjust `--withcoins` and `--withoutcoins` as desired, eg: `--withcoins=monero,bitcoin`. By default only Particl is loaded. @@ -27,10 +29,16 @@ Adjust `--withcoins` and `--withoutcoins` as desired, eg: `--withcoins=monero,bi $ docker run --rm -e XMR_RPC_HOST="node.xmr.to" -e BASE_XMR_RPC_PORT=18081 -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient \ basicswap-prepare --datadir=/coindata --withcoins=monero --htmlhost="0.0.0.0" --xmrrestoreheight=2245107 -Record the mnemonic from the output of the above command. +**Record the mnemonic from the output of the above command.** -Start the container +#### Set the timezone: + +Edit the `.env` file in the docker directory, set TZ to your local timezone. +Valid options can be listed with: `timedatectl list-timezones` + + +#### Start the container: $ export COINDATA_PATH=/var/data/coinswaps $ docker-compose up diff --git a/docker/.env b/docker/.env index f36d603..da8ef90 100644 --- a/docker/.env +++ b/docker/.env @@ -1,2 +1,3 @@ HTML_PORT=127.0.0.1:12700:12700 #COINDATA_PATH=/var/data/coinswaps +TZ=UTC diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 670c3f4..2a84e16 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -10,6 +10,8 @@ services: - ${COINDATA_PATH}:/coindata ports: - "${HTML_PORT}" # Expose only to localhost, see .env + environment: + - TZ volumes: coindata: diff --git a/docker/production/.env b/docker/production/.env index 56a7428..f50a058 100644 --- a/docker/production/.env +++ b/docker/production/.env @@ -1 +1,2 @@ HTML_PORT=127.0.0.1:12700:12700 +TZ=UTC diff --git a/docker/production/docker-compose.yml b/docker/production/docker-compose.yml index 76ecc86..655e366 100644 --- a/docker/production/docker-compose.yml +++ b/docker/production/docker-compose.yml @@ -61,6 +61,8 @@ services: - /var/swapdata/swapclient:/data ports: - "${HTML_PORT}" # Expose only to localhost, see .env + environment: + - TZ depends_on: - particl_core restart: unless-stopped diff --git a/docker/production/swapclient/Dockerfile b/docker/production/swapclient/Dockerfile index 8d60595..f4221b9 100644 --- a/docker/production/swapclient/Dockerfile +++ b/docker/production/swapclient/Dockerfile @@ -5,7 +5,7 @@ ENV LANG=C.UTF-8 \ DATADIR=/data RUN apt-get update; \ - apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config gosu; + apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config gosu tzdata; RUN wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/anonswap.zip && \ unzip coincurve-anonswap.zip && \