mirror of
https://github.com/boldsuck/haveno.git
synced 2025-01-03 14:49:25 +00:00
Fix pricenode/docker
This commit is contained in:
parent
69b5039f58
commit
435051f204
11 changed files with 39 additions and 182 deletions
|
@ -41,10 +41,10 @@ This will install the pricenode under the user `pricenode`. At the end of the in
|
||||||
To manually test endpoints, run each of the following:
|
To manually test endpoints, run each of the following:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
curl http://localhost:8080/getAllMarketPrices
|
curl http://localhost:8078/getAllMarketPrices
|
||||||
curl http://localhost:8080/getFees
|
curl http://localhost:8078/getFees
|
||||||
curl http://localhost:8080/getParams
|
curl http://localhost:8078/getParams
|
||||||
curl http://localhost:8080/info
|
curl http://localhost:8078/info
|
||||||
```
|
```
|
||||||
|
|
||||||
### Monitoring
|
### Monitoring
|
||||||
|
|
|
@ -1,26 +1,33 @@
|
||||||
###
|
###
|
||||||
# The directory of the Dockerfile should contain your 'hostname' and 'private_key' files.
|
# Haveno pricenode dockerfile
|
||||||
# In the docker-compose.yml file you can pass the ONION_ADDRESS referenced below.
|
|
||||||
###
|
###
|
||||||
|
|
||||||
# pull base image
|
# pull base image
|
||||||
FROM openjdk:8-jdk
|
FROM openjdk:11-jdk
|
||||||
|
|
||||||
|
# install tor
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
vim \
|
tor && rm -rf /var/lib/apt/lists/*
|
||||||
tor \
|
|
||||||
fakeroot \
|
|
||||||
sudo \
|
|
||||||
openjfx && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN git clone https://github.com/bisq-network/pricenode.git
|
# copy tor configuration file
|
||||||
WORKDIR /pricenode/
|
|
||||||
RUN ./gradlew assemble
|
|
||||||
|
|
||||||
COPY loop.sh start_node.sh start_tor.sh ./
|
|
||||||
COPY hostname private_key /var/lib/tor/
|
|
||||||
COPY torrc /etc/tor/
|
COPY torrc /etc/tor/
|
||||||
RUN chmod +x *.sh && chown debian-tor:debian-tor /etc/tor/torrc /var/lib/tor/hostname /var/lib/tor/private_key
|
# give proper permissions for tor configuration file
|
||||||
|
RUN chown debian-tor:debian-tor /etc/tor/torrc
|
||||||
CMD ./start_tor.sh && ./start_node.sh
|
# add haveno user
|
||||||
#CMD tail -f /dev/null
|
RUN useradd -d /haveno -G debian-tor haveno
|
||||||
|
# make haveno directory
|
||||||
|
RUN mkdir -p /haveno
|
||||||
|
# give haveno user proper permissions
|
||||||
|
RUN chown haveno:haveno /haveno
|
||||||
|
# clone haveno repository
|
||||||
|
RUN git clone https://github.com/haveno-dex/haveno.git /haveno/haveno
|
||||||
|
# build pricenode
|
||||||
|
WORKDIR /haveno/haveno
|
||||||
|
RUN ./gradlew :pricenode:installDist -x test
|
||||||
|
# set proper java options
|
||||||
|
ENV JAVA_OPTS=""
|
||||||
|
# expose ports
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 8078
|
||||||
|
# set launch command (tor and pricenode)
|
||||||
|
CMD tor && /haveno/haveno/haveno-pricenode 2
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
Needed information to start a pricenode
|
|
||||||
==
|
|
||||||
|
|
||||||
Copy to this directory:
|
|
||||||
--
|
|
||||||
|
|
||||||
* a tor `hostname` file, containing your onion address
|
|
||||||
* a tor `private_key` file, containing the private key for your tor hidden service
|
|
||||||
|
|
||||||
Edit docker-compose.yml:
|
|
||||||
--
|
|
||||||
|
|
||||||
* fill in your public and private api keys (needs a btcaverage developer subscription)
|
|
||||||
|
|
||||||
Needed software to start a pricenode
|
Needed software to start a pricenode
|
||||||
==
|
==
|
||||||
|
|
||||||
|
@ -21,7 +7,7 @@ Needed software to start a pricenode
|
||||||
How to start
|
How to start
|
||||||
==
|
==
|
||||||
|
|
||||||
`docker-compose up -d`
|
`docker compose up -d`
|
||||||
|
|
||||||
|
|
||||||
How to monitor
|
How to monitor
|
||||||
|
@ -31,13 +17,10 @@ See if it's running: `docker ps`
|
||||||
|
|
||||||
Check the logs: `docker-compose logs`
|
Check the logs: `docker-compose logs`
|
||||||
|
|
||||||
|
Check the tor hostname: `docker exec docker_pricenode_1 cat /var/lib/tor/pricenode/hostname`
|
||||||
|
|
||||||
Notes when using CoreOs
|
|
||||||
|
How to test
|
||||||
==
|
==
|
||||||
|
|
||||||
Using CoreOs as host OS is entirely optional!
|
Refer to the main pricenode [README](../README.md).
|
||||||
|
|
||||||
* the cloudconfig.yml file is a configuration file for starting a coreos machine
|
|
||||||
from scratch.
|
|
||||||
* when installing a Coreos server, docker-compose needs to be additionally installed next to the
|
|
||||||
already provided docker installation
|
|
|
@ -1,103 +0,0 @@
|
||||||
#cloud-config
|
|
||||||
|
|
||||||
coreos:
|
|
||||||
update:
|
|
||||||
reboot-strategy: off
|
|
||||||
units:
|
|
||||||
- name: iptables-restore.service
|
|
||||||
enable: true
|
|
||||||
command: start
|
|
||||||
- name: create-swap.service
|
|
||||||
command: start
|
|
||||||
runtime: true
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Create swap file
|
|
||||||
Before=swap.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
Environment="SWAPFILE=/2GiB.swap"
|
|
||||||
ExecStart=/usr/bin/touch ${SWAPFILE}
|
|
||||||
ExecStart=/usr/bin/chattr +C ${SWAPFILE}
|
|
||||||
ExecStart=/usr/bin/fallocate -l 2048m ${SWAPFILE}
|
|
||||||
ExecStart=/usr/bin/chmod 600 ${SWAPFILE}
|
|
||||||
ExecStart=/usr/sbin/mkswap ${SWAPFILE}
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
- name: swap.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Turn on swap
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
Environment="SWAPFILE=/2GiB.swap"
|
|
||||||
RemainAfterExit=true
|
|
||||||
ExecStartPre=/usr/sbin/losetup -f ${SWAPFILE}
|
|
||||||
ExecStart=/usr/bin/sh -c "/sbin/swapon $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)"
|
|
||||||
ExecStop=/usr/bin/sh -c "/sbin/swapoff $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)"
|
|
||||||
ExecStopPost=/usr/bin/sh -c "/usr/sbin/losetup -d $(/usr/sbin/losetup -j ${SWAPFILE} | /usr/bin/cut -d : -f 1)"
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
- name: restart.service
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Restart docker containers
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/home/core/docker/restartContainers.sh
|
|
||||||
- name: restart.timer
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Restarts the app container 2 times a week
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=Mon,Thu *-*-* 6:0:0
|
|
||||||
|
|
||||||
write_files:
|
|
||||||
- path: /etc/sysctl.d/swap.conf
|
|
||||||
permissions: 0644
|
|
||||||
owner: root
|
|
||||||
content: |
|
|
||||||
vm.swappiness=10
|
|
||||||
vm.vfs_cache_pressure=50
|
|
||||||
|
|
||||||
write_files:
|
|
||||||
- path: /etc/ssh/sshd_config
|
|
||||||
permissions: 0600
|
|
||||||
owner: root
|
|
||||||
content: |
|
|
||||||
# Use most defaults for sshd configuration.
|
|
||||||
UsePrivilegeSeparation sandbox
|
|
||||||
Subsystem sftp internal-sftp
|
|
||||||
UseDNS no
|
|
||||||
|
|
||||||
PermitRootLogin no
|
|
||||||
AllowUsers core
|
|
||||||
AuthenticationMethods publickey
|
|
||||||
|
|
||||||
write_files:
|
|
||||||
- path: /var/lib/iptables/rules-save
|
|
||||||
permissions: 0644
|
|
||||||
owner: 'root:root'
|
|
||||||
content: |
|
|
||||||
*filter
|
|
||||||
:INPUT DROP [0:0]
|
|
||||||
:FORWARD DROP [0:0]
|
|
||||||
:OUTPUT ACCEPT [0:0]
|
|
||||||
-A INPUT -i lo -j ACCEPT
|
|
||||||
-A INPUT -i eth1 -j ACCEPT
|
|
||||||
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
|
||||||
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
|
|
||||||
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
|
|
||||||
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
|
|
||||||
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
|
|
||||||
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
|
|
||||||
COMMIT
|
|
||||||
# the last line of the file needs to be a blank line or a comment
|
|
|
@ -1,21 +1,10 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
# Fill in your own BTCAVERAGE public and private keys
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
pricenode:
|
pricenode:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
image: bisq:pricenode
|
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
- 8080:8080
|
- 8078:8078
|
||||||
environment:
|
|
||||||
- BTCAVERAGE_PRIVKEY=!!!!!!!!!!!!!!!!!!!!!!!!! YOUR PRIVATE KEY !!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
- BTCAVERAGE_PUBKEY=!!!!!!!!!!!!!!!!!!!!!!!!!! YOUR PUBKEY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
entropy:
|
|
||||||
restart: always
|
|
||||||
image: harbur/haveged:1.7c-1
|
|
||||||
container_name: haveged-entropy
|
|
||||||
privileged: true
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
mkdir -p /opt/bin
|
|
||||||
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
|
|
||||||
chmod +x /opt/bin/docker-compose
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
echo `date` "(Re)-starting node"
|
|
||||||
java -jar ./build/libs/bisq-pricenode.jar 2 2
|
|
||||||
echo `date` "node terminated unexpectedly!!"
|
|
||||||
sleep 3
|
|
||||||
done
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
docker-compose build --no-cache && docker-compose up -d
|
|
||||||
docker image prune -f
|
|
||||||
docker-compose logs -f
|
|
|
@ -1 +0,0 @@
|
||||||
nohup sh loop.sh
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# sudo -u debian-tor
|
|
||||||
nohup sudo -u debian-tor tor > /dev/null 2>errors_tor.log &
|
|
|
@ -1,2 +1,4 @@
|
||||||
HiddenServiceDir /var/lib/tor/
|
HiddenServiceDir /var/lib/tor/pricenode/
|
||||||
HiddenServicePort 80 127.0.0.1:8080
|
HiddenServicePort 80 127.0.0.1:8078
|
||||||
|
HiddenServiceVersion 3
|
||||||
|
RunAsDaemon 1
|
||||||
|
|
Loading…
Reference in a new issue