Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Drew Sutherland
committed
Jul 17, 2021
1 parent
6136a0f
commit 1d087a9
Showing
20 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Overview | ||
|
||
Use at your own risk | ||
|
||
Start by editing the `docker-compose.yaml` to suit. | ||
|
||
The idea is that persistent storage is bind mounted in so upgrades and restarts require no further intervention beyond initial setup. The containers assume you already have a chia config (`~/.chia`), copy this somewhere else e.g `/srv/chia/config` for the bind mount into `/chia/.chia`. The container imports your key from `/chia/.chia/nmemonic.txt` file see `gui/root/etc/cont-init.d/10-chiainit.sh`. | ||
|
||
# GUI | ||
|
||
Run the container | ||
``` | ||
docker-compose -p chia up --build -d | ||
``` | ||
The gui will be available on port `5800`, it takes a couple minutes to startup | ||
|
||
## First time init | ||
|
||
TODO can't remember | ||
|
||
# Issues | ||
|
||
- The GUI tries to start all the services (which were already started by s6) this causes errors to show in logs, these can be ignored | ||
- Lots of TODOs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: "3.2" | ||
services: | ||
gui: | ||
build: gui | ||
ports: | ||
- 8444:8444 | ||
- 8447:8447 | ||
- 5800:5800 | ||
environment: | ||
TZ: "America/Denver" | ||
USER_ID: 1000 | ||
GROUP_ID: 1000 | ||
sysctls: | ||
net.ipv6.conf.lo.disable_ipv6: 0 | ||
volumes: | ||
- gui_config:/config | ||
- /srv/chia/config:/chia/.chia | ||
- /tank/chia/plots:/chia-plots-0 | ||
restart: always | ||
|
||
volumes: | ||
gui_config: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
FROM jlesage/baseimage-gui:ubuntu-18.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update | ||
# Stuff for chia install | ||
RUN apt-get install -y \ | ||
bash git lsb-release sudo apt-utils curl wget bc \ | ||
python3.7-venv python3.7-distutils \ | ||
nodejs libxss1 | ||
# Electron build deps, | ||
# TODO replace with proper runtime deps | ||
RUN apt-get install -y \ | ||
build-essential clang libdbus-1-dev libgtk-3-dev \ | ||
libnotify-dev libgnome-keyring-dev \ | ||
libasound2-dev libcap-dev libcups2-dev libxtst-dev \ | ||
libxss1 libnss3-dev gcc-multilib g++-multilib curl \ | ||
gperf bison python-dbusmock openjdk-8-jre | ||
|
||
# Update npm for 1804 | ||
RUN npm install -g n \ | ||
&& n stable | ||
|
||
# Cleanup inherited user management and make our own chia user | ||
# TODO ideally /config would be home but since it is marked as a | ||
# volume in a previous layer we can't use it because any changes | ||
# we make will be lost, this is notable for the npm install later | ||
RUN rm /etc/cont-init.d/00-app-user-map.sh \ | ||
&& rm /etc/cont-init.d/00-set-home.sh \ | ||
&& useradd -d /chia -m -u 1000 -U -s /bin/bash chia | ||
#&& useradd -d /chia -m -u 1000 -U -G sudo -s /bin/bash chia \ | ||
#&& echo "%sudo ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
# Move xdg off /cache | ||
# TODO XDG_DATA_HOME controls where python_keyring dir is | ||
# combine with ~/.pki to avoid key import | ||
ENV XDG_DATA_HOME=/chia/xdg/data \ | ||
XDG_CONFIG_HOME=/chia/xdg/config \ | ||
XDG_CACHE_HOME=/chia/xdg/cache | ||
|
||
WORKDIR /chia | ||
USER chia | ||
|
||
# Clone chia | ||
ARG BRANCH="latest" | ||
RUN git clone --branch ${BRANCH} --recursive \ | ||
https://github.com/Chia-Network/chia-blockchain.git | ||
COPY patches/ chia-blockchain/ | ||
|
||
# Install chia | ||
RUN cd chia-blockchain \ | ||
&& python3.7 -m venv venv \ | ||
&& . ./venv/bin/activate \ | ||
&& python -m pip install --upgrade pip \ | ||
&& python -m pip install wheel \ | ||
&& python -m pip install --extra-index-url https://pypi.chia.net/simple/ miniupnpc==2.2.2 \ | ||
&& python -m pip install -e . --extra-index-url https://pypi.chia.net/simple/ | ||
|
||
# Install chia gui | ||
# TODO still need to deal with all the startService calls in patch | ||
# since we manage the daemons the gui should not try to start them | ||
RUN cd chia-blockchain/chia-blockchain-gui \ | ||
&& patch -p1 < ../0001-gui-docker-compat.patch \ | ||
&& . ../venv/bin/activate \ | ||
&& npm install \ | ||
&& (npm audit fix || true) \ | ||
&& npm run build | ||
|
||
USER 0 | ||
|
||
ENV PATH="/chia/chia-blockchain/venv/bin/:$PATH" \ | ||
APP_USER=chia \ | ||
APP_NAME=ChiaGUI | ||
|
||
# configurables from previous layers | ||
# TAKE_CONFIG_OWNERSHIP=1 | ||
# DISPLAY_HEIGHT=768 | ||
# DISPLAY_WIDTH=1280 | ||
|
||
COPY root/ / | ||
|
||
# TODO versioning label | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From f27d1ec5043941860376753166d9e35acef32fea Mon Sep 17 00:00:00 2001 | ||
From: Nobody | ||
Date: Thu, 15 Jul 2021 16:04:21 -0600 | ||
Subject: [PATCH] gui docker compat | ||
|
||
--- | ||
package.json | 4 ++-- | ||
src/util/config.js | 2 +- | ||
2 files changed, 3 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/package.json b/package.json | ||
index 90e3babf..7b199a20 100644 | ||
--- a/package.json | ||
+++ b/package.json | ||
@@ -11,14 +11,14 @@ | ||
}, | ||
"scripts": { | ||
"start": "cross-env NODE_ENV=development webpack serve --config ./webpack.react.babel.ts", | ||
- "dev:electron": "cross-env NODE_ENV=development webpack --config webpack.electron.babel.ts --mode development && electron .", | ||
+ "dev:electron": "cross-env NODE_ENV=development webpack --config webpack.electron.babel.ts --mode development && electron . --no-sandbox", | ||
"dev:react": "cross-env NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 webpack serve --config webpack.react.babel.ts --mode development", | ||
"dev": "npm run locale && concurrently --kill-others \"npm run dev:react\" \"npm run dev:electron\"", | ||
"dev:fast": "concurrently --kill-others \"npm run dev:react\" \"npm run dev:electron\"", | ||
"build:electron": "cross-env NODE_ENV=production webpack --config ./webpack.electron.babel.ts", | ||
"build:react": "cross-env NODE_ENV=production NODE_OPTIONS=--max_old_space_size=4096 webpack --config ./webpack.react.babel.ts", | ||
"build": "npm run locale && npm run build:electron && npm run build:react", | ||
- "electron": "electron .", | ||
+ "electron": "electron . --no-sandbox", | ||
"locale:extract": "lingui extract", | ||
"locale:compile": "lingui compile", | ||
"locale": "lingui extract && lingui compile", | ||
diff --git a/src/util/config.js b/src/util/config.js | ||
index 5faac066..94311e94 100644 | ||
--- a/src/util/config.js | ||
+++ b/src/util/config.js | ||
@@ -49,7 +49,7 @@ function loadConfig(net) { | ||
|
||
function manageDaemonLifetime() { | ||
// only start/stop daemon if it is running locally | ||
- return self_hostname === 'localhost'; | ||
+ return false; //self_hostname === 'localhost'; | ||
} | ||
|
||
module.exports = { | ||
-- | ||
2.30.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/with-contenv sh | ||
|
||
PUID=${USER_ID:-1000} | ||
PGID=${GROUP_ID:-1000} | ||
|
||
groupmod -o -g "$PGID" chia | ||
usermod -o -u "$PUID" chia | ||
|
||
echo " | ||
chia uid: $(id -u chia) | ||
chia gid: $(id -g chia) | ||
" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/with-contenv sh | ||
export HOME=/chia | ||
|
||
s6-setuidgid chia chia init | ||
s6-setuidgid chia chia keys add -f ${HOME}/.chia/mnemonic.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/with-contenv sh | ||
export HOME=/chia | ||
exec s6-setuidgid chia chia run_daemon | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#Dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/with-contenv sh | ||
export HOME=/chia | ||
rm ${HOME}/.chia/mainnet/run/chia_farmer.pid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/with-contenv sh | ||
#s6-svwait -u /var/run/s6/services/chiadaemon | ||
export HOME=/chia | ||
exec s6-setuidgid chia chia_farmer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#Dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/with-contenv sh | ||
export HOME=/chia | ||
rm ${HOME}/.chia/mainnet/run/chia_full_node.pid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/with-contenv sh | ||
#s6-svwait -u /var/run/s6/services/chiadaemon | ||
export HOME=/chia | ||
exec s6-setuidgid chia chia_full_node | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#Dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/with-contenv sh | ||
export HOME=/chia | ||
rm ${HOME}/.chia/mainnet/run/chia_harvester.pid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/with-contenv sh | ||
#s6-svwait -u /var/run/s6/services/chiadaemon | ||
export HOME=/chia | ||
exec s6-setuidgid chia chia_harvester | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#Dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/with-contenv sh | ||
export HOME=/chia | ||
rm ${HOME}/.chia/mainnet/run/chia_wallet.pid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/with-contenv sh | ||
#s6-svwait -u /var/run/s6/services/chiadaemon | ||
export HOME=/chia | ||
exec s6-setuidgid chia chia_wallet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
export HOME=/chia | ||
|
||
. ${HOME}/chia-blockchain/venv/bin/activate | ||
|
||
cd ${HOME}/chia-blockchain/chia-blockchain-gui | ||
|
||
sleep 20 # TODO proper dependency management | ||
npm run electron | ||
|