Skip to content

Commit d92f19c

Browse files
committed
Docker development setup based on Devuan images
Also moved travis test build to use this dockerfile includes helper scripts and documentation updates
1 parent 8f035fe commit d92f19c

File tree

10 files changed

+1005
-27
lines changed

10 files changed

+1005
-27
lines changed

.travis.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
notifications:
2+
email: false
3+
4+
git:
5+
submodules:
6+
false
7+
8+
env:
9+
- RELEASE_BRANCH="master"
10+
11+
sudo: required
12+
13+
language: ruby
14+
15+
services:
16+
- docker
17+
18+
before_install:
19+
- docker build -t dyne/decodeos:travis docker-sdk
20+
21+
script:
22+
- container=$(docker create dyne/decodeos:travis)
23+
- docker start $container
24+
- docker exec $container dam-client -gen
25+
- sleep 10
26+
- docker exec $container ps axf
27+
- docker stop $container
28+
- docker rm $container
29+

Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from dyne/devuan:ascii
2+
maintainer parazyd "https://github.com/parazyd"
3+
4+
run echo "deb-src http://deb.devuan.org/merged ascii main" > /etc/apt/sources.list
5+
run echo "deb http://deb.devuan.org/merged ascii main" >> /etc/apt/sources.list
6+
run apt-get -qq update
7+
run apt-get -yy install zsh cgpt parted xz-utils qemu qemu-utils python-markdown ruby-ronn --no-install-recommends
8+
copy . .
9+
run git submodule update --init --recursive --checkout
10+

README.md

+43-27
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,42 @@
1-
# Operating System for DEcentralised Data Ecosystems
1+
# Operating System for Private and Anonymous Computation Clusters
22

33
[![software by Dyne.org](https://www.dyne.org/wp-content/uploads/2015/12/software_by_dyne.png)](http://www.dyne.org)
44

55
<div class="center">
66

7-
The DECODE operating system is designed to run on servers, embedded
8-
computers and virtual machines to automatically connect applications
9-
to a private and anonymous peer-to-peer network cluster.
7+
The DECODE operating system is a brand new GNU+Linux distribution
8+
designed to run on servers, embedded computers and virtual machines to
9+
automatically connect micro-services to a private and anonymous
10+
peer-to-peer network cluster.
1011

1112
</div>
1213

13-
![DECODE OS logo](https://decodeos.dyne.org/img/decodeos_logo-800px.jpg)
14+
<img src="https://decodeos.dyne.org/img/decodeos_logo-800px.jpg" class="pic" alt="DECODE OS logo">
1415

15-
| Features | Components |
16-
|--------------------------------------------|--------------------------------------------------------------------------------|
17-
| Wide compatibility with industry standards | GNU + Linux minimal base |
18-
| Anonimity and privacy by design | [Tor](https://torproject.org) hidden service family |
19-
| Very secure, restricted environment | [grsec](https://github.com/minipli/linux-unofficial_grsec/wiki) community fork |
20-
| Customisable to run different applications | [Devuan](https://devuan.org) GNU+Linux SDK |
21-
| Pluggable consensus algorithm | [Redis](https://redis.io) based consensus broker |
22-
| Read-only and authenticated system | SquashFS + overlayfs + Btrfs |
23-
| Integrated updating mechanism | [Roundshot](https://github.com/DECODEproject/roundshot) initramfs |
24-
| Low power consumption, outdoor usage | Ports to embedded ARM boards |
16+
| Features | Components |
17+
|--------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
18+
| Wide compatibility with industry standards | GNU + Linux minimal base |
19+
| Anonimity and privacy by design | [Tor](https://torproject.org) hidden service family |
20+
| Very secure, restricted environment | [grsec](https://github.com/minipli/linux-unofficial_grsec/wiki) community fork |
21+
| Customisable to run different applications | [Devuan](https://devuan.org) GNU+Linux SDK |
22+
| Pluggable consensus algorithm | [Redis](https://redis.io) based consensus broker |
23+
| Read-only and authenticated system | [SquashFS](http://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html) + [overlayfs](https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt) + [Btrfs](https://btrfs.wiki.kernel.org/index.php/Main_Page) |
24+
| Integrated updating mechanism | [Roundshot](https://github.com/DECODEproject/roundshot) initramfs |
25+
| Low power consumption, outdoor usage | Ports to embedded ARM boards |
26+
| Extensible platform support | Includes latest JDK, Golang, Python etc. |
27+
| Minimal resource consumption | Online with less than 64MB of RAM |
2528

26-
For stable releases see https://files.dyne.org/decode
29+
## For stable releases see <a href="https://files.dyne.org/decode">files.dyne.org/decode</a>
2730

28-
For more information about the DECODE project see https://decodeproject.eu
31+
## For more information see <a href="https://decodeproject.eu">the DECODE project</a>
2932

30-
## Usage
33+
In particular, the following publications:
34+
35+
- <a href="https://decodeproject.eu/publications/privacy-design-strategies-decode-architecture">Privacy Design Strategies for the DECODE Architecture</a>
36+
- <a href="https://decodeproject.eu/publications/decode-os-first-release">Decode OS first release</a>
37+
- <a href="https://decodeproject.eu/publications/decode-os-software-development-kit">DECODE OS Software Development Kit</a> (soon to be superseeded by the upcoming Devuan's Developer Manual)
38+
39+
## Usage instructions
3140

3241
DECODE OS comes in a variety of flavors:
3342

@@ -42,26 +51,33 @@ The default username is `decode` with password `decode`
4251

4352
The default `root` password is `toor`.
4453

45-
## Support
54+
## Get in touch!
4655

4756
Developers of the Dyne.org foundation are available to support
4857
customisations and adaptations of this operating system for particular
4958
purposes in line with the foundation's goals.
5059

60+
You are welcome to contact us:
61+
62+
- **#devuan-dev** on **freenode** IRC (public, logged IPs)
63+
- **#dyne** on <a href="https://irc.dyne.org">irc.dyne.org</a> (public and private, no IPs logged)
64+
- E-mail **[email protected]**
65+
5166
This project is a work in progress proceeding along a clear roadmap
52-
agreed for the DECODE project. The DECODE OS stable release is planned
53-
for 1st quarter 2019.
67+
agreed for the DECODE project. The DECODE OS **stable release is planned
68+
for 1st quarter 2019**.
5469

55-
![Horizon 2020](https://zenroom.dyne.org/img/ec_logo.png)
70+
<img alt="Horizon 2020" src="https://zenroom.dyne.org/img/ec_logo.png" class="pic">
5671

57-
This project is receiving funding from the European Union’s Horizon
72+
This project is receiving funding from the **European Union’s Horizon
5873
2020 research and innovation programme under grant agreement
59-
nr. 732546 (DECODE).
74+
nr. 732546**.
6075

61-
## Build
76+
## Build from source
6277

6378
The following instructions illustrate how one can build DECODE OS from
64-
scratch, eventually adding software to it.
79+
scratch, eventually adding software to it. This section is a work in
80+
progress.
6581

6682
Building can be done from any GNU+Linux distribution, it entails
6783
bootstrapping a new Devuan base and then customising it via its SDK
@@ -73,7 +89,7 @@ Developers Manual", here is an outline on the steps to be taken.
7389

7490

7591

76-
### Requirements
92+
### System requirements
7793

7894
A GNU/Linux system is required in order to build DECODE OS.
7995

docker-sdk/Dockerfile

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#
2+
# Build this image with the command
3+
# docker build -f docker/build -t dyne/clojure:latest
4+
#
5+
# Then run with the command
6+
# docker run -p 3000:3000 -it dyne/clojure:latest
7+
#
8+
9+
FROM dyne/devuan:beowulf
10+
ENV debian buster
11+
12+
LABEL maintainer="Denis Roio <[email protected]>" \
13+
homepage="https://github.com/decodeproject/decode-os"
14+
15+
ENV LC_ALL C
16+
ENV DEBIAN_FRONTEND noninteractive
17+
18+
# CLI arguments
19+
ARG foreground=true
20+
21+
ENV DYNESDK=https://sdk.dyne.org:4443/job \
22+
NETDATA_VERSION=1.10.0 \
23+
STEM_VERSION=1.6.0 \
24+
STEM_GIT=https://git.torproject.org/stem.git
25+
26+
ENV BUILD_DEPS="build-essential zlib1g-dev gcc make autoconf automake pkg-config uuid-dev golang"
27+
WORKDIR /root
28+
29+
# # debugging travis (finds gpg in local builds)
30+
RUN apt-get -yq update \
31+
&& apt-get -yq install gnupg1 ca-certificates --no-install-recommends \
32+
&& echo "ENVIRONMENT VARIABLES:" \
33+
&& export
34+
35+
# Tor repository
36+
COPY tor.pub.asc tor.pub.asc
37+
RUN apt-key add tor.pub.asc
38+
RUN echo "deb https://deb.torproject.org/torproject.org $debian main" \
39+
>> /etc/apt/sources.list
40+
41+
# Nodejs repository
42+
ADD https://deb.nodesource.com/gpgkey/nodesource.gpg.key nodesource.gpg.key
43+
RUN apt-key add nodesource.gpg.key
44+
RUN echo "deb https://deb.nodesource.com/node_8.x $debian main" \
45+
>> /etc/apt/sources.list
46+
47+
RUN mkdir -p /usr/share/man/man1/ \
48+
&& apt-get -yy update && apt-get -yy upgrade \
49+
&& apt-get -yy install tor deb.torproject.org-keyring \
50+
supervisor daemontools \
51+
tmux curl redis-tools redis-server net-tools \
52+
python3 python3-stem nodejs
53+
54+
RUN apt-get -yq install $BUILD_DEPS
55+
56+
# Latest Zenroom built static for x86-amd64 taken from our own builds at Dyne.org
57+
ADD $DYNESDK/zenroom-static-amd64/lastSuccessfulBuild/artifact/src/zenroom-static /usr/bin/zenroom
58+
RUN chmod +x /usr/bin/zenroom
59+
60+
# Compile some software from the source
61+
WORKDIR /usr/src
62+
63+
# Stem built from source
64+
# RUN git clone $STEM_GIT && cd stem && git checkout -b $STEM_VERSION $STEM_VERSION && python3 setup.py install
65+
66+
# Configure Tor Controlport auth
67+
ENV TORDAM_GIT=github.com/decodeproject/tor-dam
68+
RUN torpass=`echo "print(RNG.new():octet(16):base58())" | zenroom` \
69+
&& go get -v -u $TORDAM_GIT/... && cd ~/go/src/github.com/decodeproject/tor-dam \
70+
&& sed -i python/damhs.py -e "s/topkek/$torpass/" \
71+
&& sed -i python/damauth.py -e "s/topkek/$torpass/" \
72+
&& make install && make -C contrib install-init \
73+
&& torpasshash=`HOME=/var/lib/tor setuidgid debian-tor tor --hash-password "$torpass"` \
74+
&& sed -e 's/User tor/User debian-tor/' < contrib/torrc > /etc/tor/torrc \
75+
&& sed -e 's/HashedControlPassword .*//' -i /etc/tor/torrc \
76+
&& echo "HashedControlPassword $torpasshash" >> /etc/tor/torrc
77+
RUN chmod -R go-rwx /etc/tor && chown -R debian-tor /etc/tor \
78+
&& rm -rf /var/lib/tor/data && chown -R debian-tor /var/lib/tor \
79+
&& mkdir -p /var/run/tor && chown -R debian-tor /var/run/tor
80+
RUN cp /root/go/bin/dam* /usr/bin
81+
82+
# fix npm - not the latest version installed by apt-get
83+
RUN npm install -g npm
84+
RUN npm install -g redis-commander
85+
ENV REDIS_HOSTS=localhost
86+
87+
# Netdata
88+
ADD https://github.com/firehol/netdata/releases/download/v$NETDATA_VERSION/netdata-${NETDATA_VERSION}.tar.gz netdata.tgz
89+
RUN tar xf netdata.tgz && cd netdata-$NETDATA_VERSION \
90+
&& ./netdata-installer.sh --dont-wait --dont-start-it \
91+
&& cd - && rm -rf netdata.tgz netdata-$NETDATA_VERSION
92+
93+
# Openresty
94+
ADD https://openresty.org/package/pubkey.gpg openresty.gpg
95+
RUN apt-key add openresty.gpg
96+
RUN echo "deb http://openresty.org/package/debian stretch openresty" \
97+
>> /etc/apt/sources.list
98+
RUN apt-get -yq update \
99+
&& apt-get -yq install --no-install-recommends openresty
100+
101+
# cleanup
102+
RUN apt-get -yq remove --purge $BUILD_DEPS \
103+
&& apt-get -yq --purge autoremove && apt-get -yq clean \
104+
&& npm cache clean --force && npm uninstall -g npm
105+
106+
COPY supervisord.conf /etc/supervisor/supervisord.conf
107+
RUN sed -i "s/nodaemon=true/nodaemon=$foreground/" /etc/supervisor/supervisord.conf
108+
109+
RUN groupadd -g 6000 app && useradd -r -u 6000 -g app -d /home/app app
110+
WORKDIR /home/app
111+
RUN chown -R app:app /home/app
112+
113+
# Tor's socks5
114+
EXPOSE 9150
115+
# supervisor
116+
EXPOSE 9001 9001
117+
# redis-commander
118+
EXPOSE 8081 8081
119+
# netdata
120+
EXPOSE 19999 19999
121+
122+
CMD bash -c '/etc/init.d/supervisor start'

docker-sdk/README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# DECODE OS - Docker facility
2+
3+
4+
[![Powered by DECODE OS](https://decodeos.dyne.org/img/decodeos_logo-800px.jpg)](https://decodeos.dyne.org)
5+
6+
The DECODE operating system is a brand new GNU+Linux distribution designed to run on servers, embedded computers and virtual machines to automatically connect micro-services to a private and anonymous peer-to-peer network cluster.
7+
8+
This is a Docker build of it to facilitate development and testing.
9+
10+
## DO NOT USE IN PRODUCTION
11+
12+
This Docker image is provided only for testing and showcase. We do release DECODE OS images for use in production on https://files.dyne.org/decode
13+
14+
In order to test DECODE OS in Docker is possible to get the latest image with:
15+
```
16+
docker pull dyne/decodeos:latest
17+
```
18+
19+
And then run it with:
20+
```
21+
docker run -it -p 9150 -p 9001:9001 -p 8081:8081 -p 19999:19999 dyne/decodeos:latest
22+
```
23+
24+
Then connect to the web interfaces to monitor the functioning of DECODE OS:
25+
- http://localhost:9001 to supervise the daemons running and their logs
26+
- http://localhost:8081 to access the list of nodes and their values
27+
- http://localhost:19999 to monitor the resource usage
28+
29+
At last, you can use localhost port 9150 using Socks5 connections to be routed through Tor. Your application may then interact with the listed nodes.
30+
31+
## Build
32+
33+
To re-build this docker image:
34+
```
35+
docker build dyne/decodeos:local .
36+
```
37+

docker-sdk/exposed-ports

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
9001:9001
2+
8081:8081
3+
19999:19999
4+
9150:9150

docker-sdk/keygen

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
container=$(docker create dyne/decodeos:latest)
4+
container=$(docker start $container)
5+
onion=$(docker exec $container dam-client -gen 2>&1| awk '/Our hostname/ {print $6}')
6+
echo "New DECODE-OS node address: $onion"
7+
image=$(docker commit $container dyne/decodeos:$onion)
8+
echo "Docker image: dyne/decodeos:$onion"
9+
echo "$image"
10+
container=$(docker stop $container)
11+
12+

docker-sdk/run

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
ports=""
4+
exposed=$(cat exposed-ports);
5+
for i in $exposed; do
6+
ports="$ports -p $i"
7+
done
8+
echo "Starting DECODE OS Docker"
9+
for p in $exposed; do
10+
echo "port exposed: http://localhost:`echo $p | cut -d: -f2`"
11+
done
12+
docker run -it $ports dyne/decodeos:latest

docker-sdk/supervisord.conf

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
[supervisord]
3+
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
4+
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
5+
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
6+
nodaemon=true
7+
8+
; supervisor web GUI
9+
[inet_http_server]
10+
port=*:9001
11+
; username=decode
12+
; password=decode
13+
14+
; the below section must remain in the config file for RPC
15+
; (supervisorctl/web interface) to work, additional interfaces may be
16+
; added by defining them in separate rpcinterface: sections
17+
[rpcinterface:supervisor]
18+
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
19+
20+
[supervisorctl]
21+
serverurl=http://127.0.0.1:9001
22+
; username=decode
23+
; password=decode
24+
prompt=DECODE
25+
26+
[program:tor]
27+
command=tor
28+
29+
[program:dam-dir]
30+
command=dam-dir
31+
redirect_stderr=true
32+
33+
[program:dam-client]
34+
command=dam-client
35+
redirect_stderr=true
36+
37+
[program:redis-commander]
38+
command=redis-commander
39+
user=app
40+
41+
[program:netdata]
42+
command=netdata -D
43+
user=netdata
44+
45+
[group:network]
46+
programs=tor,dam-dir,dam-client,redis-commander,netdata
47+
priority=10
48+
umask=022
49+
autostart=true
50+
startsecs=10

0 commit comments

Comments
 (0)