From 21c6b40156db5a505215d4ce57fcab0ff6691300 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 17 Feb 2020 21:20:12 +0100 Subject: move unmaintained files to historic/ --- historic/docker/README | 90 +++++++++++++++++++++++++++++ historic/docker/TODO | 28 +++++++++ historic/docker/base/Dockerfile | 54 +++++++++++++++++ historic/docker/base/README | 7 +++ historic/docker/debug/client/Dockerfile | 7 +++ historic/docker/debug/client/dbstart.sh | 4 ++ historic/docker/debug/docker-compose.yml | 9 +++ historic/docker/debug/shell/Dockerfile | 4 ++ historic/docker/exchange/Dockerfile | 17 ++++++ historic/docker/exchange/README | 12 ++++ historic/docker/exchange/docker-compose.yml | 19 ++++++ historic/docker/exchange/entry_point.sh | 23 ++++++++ historic/docker/merchant/Dockerfile | 19 ++++++ historic/docker/merchant/docker-compose.yml | 21 +++++++ historic/docker/merchant/entry_point.sh | 13 +++++ historic/docker/merchant/exchange_pub.txt | 1 + historic/docker/merchant/exchange_url.txt | 1 + historic/docker/nginx/Dockerfile | 3 + historic/docker/nginx/nginx.conf | 33 +++++++++++ historic/docker/nginx/proxy.conf | 14 +++++ historic/docker/postgres/Dockerfile | 1 + historic/docker/postgres/README | 3 + historic/docker/taler-full/Dockerfile | 59 +++++++++++++++++++ historic/docker/taler-full/README | 2 + 24 files changed, 444 insertions(+) create mode 100644 historic/docker/README create mode 100644 historic/docker/TODO create mode 100644 historic/docker/base/Dockerfile create mode 100644 historic/docker/base/README create mode 100644 historic/docker/debug/client/Dockerfile create mode 100755 historic/docker/debug/client/dbstart.sh create mode 100644 historic/docker/debug/docker-compose.yml create mode 100644 historic/docker/debug/shell/Dockerfile create mode 100644 historic/docker/exchange/Dockerfile create mode 100644 historic/docker/exchange/README create mode 100644 historic/docker/exchange/docker-compose.yml create mode 100755 historic/docker/exchange/entry_point.sh create mode 100644 historic/docker/merchant/Dockerfile create mode 100644 historic/docker/merchant/docker-compose.yml create mode 100755 historic/docker/merchant/entry_point.sh create mode 100644 historic/docker/merchant/exchange_pub.txt create mode 100644 historic/docker/merchant/exchange_url.txt create mode 100644 historic/docker/nginx/Dockerfile create mode 100644 historic/docker/nginx/nginx.conf create mode 100644 historic/docker/nginx/proxy.conf create mode 100644 historic/docker/postgres/Dockerfile create mode 100644 historic/docker/postgres/README create mode 100644 historic/docker/taler-full/Dockerfile create mode 100644 historic/docker/taler-full/README (limited to 'historic/docker') diff --git a/historic/docker/README b/historic/docker/README new file mode 100644 index 0000000..6998ee3 --- /dev/null +++ b/historic/docker/README @@ -0,0 +1,90 @@ +=== Dockerizing the Exchange/Merchant === + +This section shows how to run a "dockerized" exchange/merchant. +The exchange uses postgresql (container) and is served +by nginx (container). The merchant instead depends on exchange +(container) and postgresql (container). + +The docker's tools needed are: docker, docker-compose, docker-machine. +Please refer to Docker's official documentation for their installation +instructions. + +Before starting to build the exchange/merchant's image, make sure a +docker-machine instance is up and running. + +1. Build the images. + + is either 'exchange' or 'merchant', depending on what is +to be built. + +From , give: + +# NOTE for 'merchant' build: as default, the merchant is configured +# to work with the 'demo' exchange running at exchange.demo.taler.net. +# Nonetheless, edit (before building) the files +# /docker/merchant/exchange_{pub,url}.txt, in case the merchant +# needs to work with any other exchange. + +$ docker-compose build + +2. Launch the service. + +The following command launches the and all other services +it depends on. From the same directory as the previous step, issue: + +$ docker-compose up + +If everything worked as expected, you should see some live logging +from all the containers. +(Errors about existing roles/databases can be ignored.) + +3. Test + +Issue the following command to see if the has been +correctly installed and launched. + +# Some 'greeting' message should be returned. Note, the +# service runs on port 80. + +$ curl http://`docker-machine ip`/ + + +=== How to use these images === + +This section explains how to (1) build and (2) run individual +images -- that is often not useful to run services, as they need +to be "composed" in order to work properly. + +(1) is done by: + +$ docker build -t taler/base /docker/base/ +$ docker build -t taler/exchange /docker/exchange/ + +Note that the value passed to option -t is completely arbitrary. + +(2) is done by: + +$ docker run -it taler/exchange + +=== How to destroy them === + +Consider also the --no-cache option to force a rebuild. + + $ docker build --no-cache /docker/base + +1. Stop all containers: + + $ docker stop $(docker ps -a -q) + + +2. If necessary, remove all containers: + + $ docker rm $(docker ps -a -q) + +3. Remove images: + + $ docker rmi -f $(docker images -q) + + +NOTE: for tripwire users, those commands are all defined + as aliases. diff --git a/historic/docker/TODO b/historic/docker/TODO new file mode 100644 index 0000000..387f758 --- /dev/null +++ b/historic/docker/TODO @@ -0,0 +1,28 @@ +Missing containers: + +- "standalone" ones: they actually *run* the + service and may also link to configuration on + the host machine when they are launched. + +- frontends + +- bank (more importantly needed to test the TGZ + which comes from 'make dist') + +- postgres (as a running service) + +- Feed configuration to exchange and merchant containers, + from outside (?) the container + +Missing compositions: + +Ideally, the Docker setting should instantiate two +Taler flavours: + +- Self-contained testing: all components ready to be + tested by the automated clicker, AKA they are a replacement + for what runs at *.{test,demo}.taler.net + +- Ready-to-ship: a composition that instantiates a fully + operational exchange or merchant, according to the customer + needs. diff --git a/historic/docker/base/Dockerfile b/historic/docker/base/Dockerfile new file mode 100644 index 0000000..39e2c32 --- /dev/null +++ b/historic/docker/base/Dockerfile @@ -0,0 +1,54 @@ +FROM debian:unstable + +RUN apt-get update && apt-get install -qqy \ + git \ + build-essential \ + autoconf \ + autopoint \ + libtool \ + libgcrypt20 \ + libgcrypt20-dev \ + libidn11-dev \ + zlib1g-dev \ + libunistring-dev \ + libjansson-dev \ + libpq-dev \ + libmicrohttpd-dev \ + libcurl4-gnutls-dev \ + python3 \ + python3-pip \ + postgresql + +# Needed to run the config generator +RUN pip3 install click + +ENV HOME /root + +RUN git clone https://gnunet.org/git/gnunet/ ~/gnunet \ + && git clone https://gnunet.org/git/libmicrohttpd/ ~/libmicrohttpd \ + && git clone git://taler.net/deployment ~/deployment + +WORKDIR $HOME/gnunet + +RUN ./bootstrap \ + && ./configure --with-libgnurl=/usr/local/ \ + && make \ + && make install + +WORKDIR $HOME/libmicrohttpd + +RUN ./bootstrap \ + && ./configure --disable-doc \ + && make \ + && make install + +# To run the config generator, need: +WORKDIR $HOME/deployment + +ENV LD_LIBRARY_PATH "/usr/local/lib" + +RUN export TALER_CONFIG_ENV="test" \ + && export TALER_CONFIG_CURRENCY="EUR" \ + && export LC_ALL="C.UTF-8" \ + && export LANG="C.UTF-8" \ + && ./bin/taler-deployment-config-generate diff --git a/historic/docker/base/README b/historic/docker/base/README new file mode 100644 index 0000000..573f4ef --- /dev/null +++ b/historic/docker/base/README @@ -0,0 +1,7 @@ +This image serves as a basis to build exchange and merchant +backend. It is responsible for installing the following packages: + +- GNUnet +- Libjansson +- Postgres +- ... diff --git a/historic/docker/debug/client/Dockerfile b/historic/docker/debug/client/Dockerfile new file mode 100644 index 0000000..5c3f0ee --- /dev/null +++ b/historic/docker/debug/client/Dockerfile @@ -0,0 +1,7 @@ +FROM debian:unstable + +RUN apt-get update && apt-get install -qqy postgresql + +COPY ./dbstart.sh / + +ENTRYPOINT ["./dbstart.sh"] diff --git a/historic/docker/debug/client/dbstart.sh b/historic/docker/debug/client/dbstart.sh new file mode 100755 index 0000000..a3d3726 --- /dev/null +++ b/historic/docker/debug/client/dbstart.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +su -c "createuser --host=dbcontainer root" postgres +su -c "createdb --host=dbcontainer talertest" postgres diff --git a/historic/docker/debug/docker-compose.yml b/historic/docker/debug/docker-compose.yml new file mode 100644 index 0000000..390f461 --- /dev/null +++ b/historic/docker/debug/docker-compose.yml @@ -0,0 +1,9 @@ +version: '2' +services: + client: + build: ./client + image: taler/debug/db + depends_on: + - dbcontainer + dbcontainer: + image: postgres diff --git a/historic/docker/debug/shell/Dockerfile b/historic/docker/debug/shell/Dockerfile new file mode 100644 index 0000000..24e8371 --- /dev/null +++ b/historic/docker/debug/shell/Dockerfile @@ -0,0 +1,4 @@ +FROM debian:unstable + +RUN apt-get update && apt-get install -qqy \ + postgresql diff --git a/historic/docker/exchange/Dockerfile b/historic/docker/exchange/Dockerfile new file mode 100644 index 0000000..d56754c --- /dev/null +++ b/historic/docker/exchange/Dockerfile @@ -0,0 +1,17 @@ +FROM taler/base + +RUN git clone git://taler.net/exchange ~/exchange + +WORKDIR $HOME/exchange + +RUN ./bootstrap \ + && ./configure CFLAGS='-ggdb -O0' \ + --with-libgnurl=/usr/local \ + --with-microhttpd=/usr/local \ + --with-gnunet=/usr/local \ + && make \ + && make install + +COPY ./entry_point.sh / + +ENTRYPOINT ["/entry_point.sh"] diff --git a/historic/docker/exchange/README b/historic/docker/exchange/README new file mode 100644 index 0000000..45ce7cb --- /dev/null +++ b/historic/docker/exchange/README @@ -0,0 +1,12 @@ +Launch the exchange, from the upper directory: + +1. Build the container: + + $ docker-compose build exchange + +2. Launch it + + $ docker-compose run -p 5555:8081 -p 5556:18080 exchange + + # Replace 5555, 5556 with the port which is to serve the normal + # and /admin services. diff --git a/historic/docker/exchange/docker-compose.yml b/historic/docker/exchange/docker-compose.yml new file mode 100644 index 0000000..284af86 --- /dev/null +++ b/historic/docker/exchange/docker-compose.yml @@ -0,0 +1,19 @@ +version: '2' +services: + exchange: + build: . + depends_on: + - dbcontainer + - base + image: taler/exchange + base: + build: ../base + image: taler/base + dbcontainer: + image: postgres + nginx: + build: ../nginx + depends_on: + - exchange + ports: + - "80:80" diff --git a/historic/docker/exchange/entry_point.sh b/historic/docker/exchange/entry_point.sh new file mode 100755 index 0000000..de21a39 --- /dev/null +++ b/historic/docker/exchange/entry_point.sh @@ -0,0 +1,23 @@ +#!/bin/bash + + +if ! test -a $HOME/shared-data/exchange/offline-keys/master.priv; then + echo "Regenerating all keys and db entries" + (su -c "createuser --host=dbcontainer root" - postgres | exit 0) + (su -c "createdb --host=dbcontainer talertest" - postgres | exit 0) + mkdir -p $HOME/shared-data/exchange/offline-keys/ + gnunet-ecc -g1 $HOME/shared-data/exchange/offline-keys/master.priv + taler-config -s exchangedb-postgres -o db_conn_str \ + -V "dbname=talertest host=dbcontainer" + taler-config -s exchange -o serve -V tcp + taler-config -s exchange -o port -V 8081 + taler-config -s exchange-admin -o serve -V tcp + taler-config -s exchange-admin -o port -V 18080 + taler-config -s exchange -o master_public_key \ + -V $(gnunet-ecc -p $HOME/shared-data/exchange/offline-keys/master.priv) + $HOME/deployment/bin/taler-deployment-config-sign + $HOME/deployment/bin/taler-deployment-keyup + taler-exchange-dbinit -r +fi + +taler-exchange-httpd diff --git a/historic/docker/merchant/Dockerfile b/historic/docker/merchant/Dockerfile new file mode 100644 index 0000000..b8d682b --- /dev/null +++ b/historic/docker/merchant/Dockerfile @@ -0,0 +1,19 @@ +FROM taler/exchange + +RUN git clone git://taler.net/merchant ~/merchant + +WORKDIR $HOME/merchant + +RUN ./bootstrap \ + && ./configure CFLAGS='-ggdb -O0' \ + --with-gnunet=/usr/local \ + --with-exchange=/usr/local \ + --with-microhttpd=/usr/local \ + && make \ + && make install + +COPY ./entry_point.sh / +COPY ./exchange_pub.txt / +COPY ./exchange_url.txt / + +ENTRYPOINT ["/entry_point.sh"] diff --git a/historic/docker/merchant/docker-compose.yml b/historic/docker/merchant/docker-compose.yml new file mode 100644 index 0000000..ccbfb70 --- /dev/null +++ b/historic/docker/merchant/docker-compose.yml @@ -0,0 +1,21 @@ +version: '2' +services: + merchant: + build: . + depends_on: + - dbcontainer + - exchange + ports: + - "80:9966" + base: + build: ../base + image: taler/base + dbcontainer: + image: postgres + exchange: + build: ../exchange + depends_on: + - dbcontainer + - base + image: taler/exchange + entrypoint: "true" diff --git a/historic/docker/merchant/entry_point.sh b/historic/docker/merchant/entry_point.sh new file mode 100755 index 0000000..515c318 --- /dev/null +++ b/historic/docker/merchant/entry_point.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + +(su -c "createuser --host=dbcontainer root" - postgres | exit 0) +(su -c "createdb --host=dbcontainer talertest" - postgres | exit 0) +taler-config -s merchantdb-postgres -o config \ + -V "dbname=talertest host=dbcontainer" +taler-config -s merchant -o serve -V tcp +taler-config -s merchant -o port -V 9966 +taler-config -s merchant-exchange-test -o master_key -V $(cat /exchange_pub.txt|tr -d '\n') +taler-config -s merchant-exchange-test -o url -V $(cat /exchange_url.txt | tr -d '\n') +taler-merchant-dbinit -r +taler-merchant-httpd diff --git a/historic/docker/merchant/exchange_pub.txt b/historic/docker/merchant/exchange_pub.txt new file mode 100644 index 0000000..69f831b --- /dev/null +++ b/historic/docker/merchant/exchange_pub.txt @@ -0,0 +1 @@ +CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00 diff --git a/historic/docker/merchant/exchange_url.txt b/historic/docker/merchant/exchange_url.txt new file mode 100644 index 0000000..a2f087f --- /dev/null +++ b/historic/docker/merchant/exchange_url.txt @@ -0,0 +1 @@ +https://exchange.demo.taler.net/ diff --git a/historic/docker/nginx/Dockerfile b/historic/docker/nginx/Dockerfile new file mode 100644 index 0000000..5636699 --- /dev/null +++ b/historic/docker/nginx/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx + +COPY ./proxy.conf /etc/nginx/conf.d/default.conf diff --git a/historic/docker/nginx/nginx.conf b/historic/docker/nginx/nginx.conf new file mode 100644 index 0000000..d9a2177 --- /dev/null +++ b/historic/docker/nginx/nginx.conf @@ -0,0 +1,33 @@ + +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} diff --git a/historic/docker/nginx/proxy.conf b/historic/docker/nginx/proxy.conf new file mode 100644 index 0000000..b4bf54a --- /dev/null +++ b/historic/docker/nginx/proxy.conf @@ -0,0 +1,14 @@ +server { + listen *:80; + root /dev/null; + + location / { + autoindex off; + proxy_pass http://exchange:8081; + } + + location /admin { + autoindex off; + proxy_pass http://exchange:18080; + } +} diff --git a/historic/docker/postgres/Dockerfile b/historic/docker/postgres/Dockerfile new file mode 100644 index 0000000..d3f2fcb --- /dev/null +++ b/historic/docker/postgres/Dockerfile @@ -0,0 +1 @@ +FROM postgres diff --git a/historic/docker/postgres/README b/historic/docker/postgres/README new file mode 100644 index 0000000..4584f0e --- /dev/null +++ b/historic/docker/postgres/README @@ -0,0 +1,3 @@ +This container is to run Postgres service. + +It has to create the "root" user and the "talertest" database. diff --git a/historic/docker/taler-full/Dockerfile b/historic/docker/taler-full/Dockerfile new file mode 100644 index 0000000..ac01271 --- /dev/null +++ b/historic/docker/taler-full/Dockerfile @@ -0,0 +1,59 @@ +FROM debian:jessie + +ENV PREFIX=/usr + +RUN apt-get update && apt-get install -y \ + git subversion \ + make \ + autoconf autopoint libtool texinfo \ + libgcrypt-dev libidn11-dev zlib1g-dev libunistring-dev \ + libjansson-dev \ + libsqlite3-dev \ + libpq-dev postgresql \ + python3-pip \ + \ + && \ + rm -rf /var/lib/apt/lists/* + +RUN pip3 install -U pip + +RUN git clone git://taler.net/deployment \ + && \ + deployment/bootstrap-hybrid + +RUN $HOME/deployment/taler-build/invalidate.sh \ + && \ + cd $HOME/deployment/taler-build && make; + +# cannot get $HOME to work +ENV PATH=/root/local/bin:$PATH + +RUN taler-config-generate -e -m -C PUDOS -m -e -w test \ + --bank-url https://bank.test.taler.net \ + --exchange-bank-account 2 \ + --merchant-bank-account 3 \ + --trusted + +RUN service postgresql start \ + && \ + su -c 'psql -c "CREATE ROLE root WITH SUPERUSER LOGIN"' postgres \ + && \ + su -c 'psql -c "CREATE DATABASE taler WITH OWNER root"' postgres \ + && \ + su -c 'psql -c "CREATE DATABASE talermerchant WITH OWNER root"' postgres + +RUN printf '#!/bin/bash \n \ + taler-exchange-keyup \ + && taler-exchange-keycheck \ + && service postgresql start \ + && taler-exchange-dbinit \ + && taler-exchange-httpd' > $HOME/local/bin/launch_exchange \ + && \ + chmod +x $HOME/local/bin/launch_exchange.sh + +RUN printf '#!/bin/bash \n \ + service postgresql start \ + && \ + taler-merchant-httpd' > $HOME/local/bin/launch_merchant \ + && \ + chmod +x $HOME/local/bin/launch_merchant.sh diff --git a/historic/docker/taler-full/README b/historic/docker/taler-full/README new file mode 100644 index 0000000..d5316aa --- /dev/null +++ b/historic/docker/taler-full/README @@ -0,0 +1,2 @@ +OBSOLETE. Kept around for the sole purpose of grasping +commands from it. -- cgit v1.2.3