diff options
Diffstat (limited to 'sandcastle/images')
19 files changed, 0 insertions, 1023 deletions
diff --git a/sandcastle/images/base/Dockerfile b/sandcastle/images/base/Dockerfile deleted file mode 100644 index 31a22c1..0000000 --- a/sandcastle/images/base/Dockerfile +++ /dev/null @@ -1,218 +0,0 @@ -FROM debian:bookworm AS base-system - -# FIXMEs: -# - debian packages should be built with a nightly tag -# - the final image contains all build dependencies, this isn't really necessary -# - the final image contains -dev packages, not really necessary -# - GNUnet build dependencies are excessive, maybe we can just build the required libs? - -RUN apt-get update && apt-get -y upgrade && apt-get --no-install-recommends install -y \ - autoconf \ - autopoint \ - build-essential \ - po-debconf \ - debhelper-compat \ - apt-utils \ - libtool \ - texinfo \ - libgcrypt-dev \ - libidn11-dev \ - zlib1g-dev \ - libunistring-dev \ - libjansson-dev \ - git \ - recutils \ - libsqlite3-dev \ - libpq-dev \ - libmicrohttpd-dev \ - libsodium-dev \ - libqrencode-dev \ - zip \ - unzip \ - jq \ - npm \ - openjdk-17-jre-headless \ - openjdk-17-jdk-headless \ - nano \ - procps \ - python3-jinja2 \ - python3-pip \ - python3-sphinx \ - python3-sphinx-rtd-theme \ - python3-venv \ - python3-dev \ - nodejs \ - iptables \ - miniupnpc \ - libextractor-dev \ - libbluetooth-dev \ - libcurl4-gnutls-dev \ - libogg-dev \ - libopus-dev \ - libpulse-dev \ - fakeroot \ - libzbar-dev \ - libltdl-dev \ - net-tools - -# old: libzbar-dev - -# FIXME: Try to use debian packages where possible and otherwise really use -# a venv or per-user installation of the package. -RUN pip3 install --break-system-packages requests click poetry uwsgi htmlark sphinx-book-theme - -# GNUnet -FROM base-system AS gnunet - -COPY buildconfig/gnunet.tag /buildconfig/ -WORKDIR /build -RUN TAG=$(cat /buildconfig/gnunet.tag) && \ - git clone git://git.gnunet.org/gnunet \ - --branch $TAG -WORKDIR /build/gnunet -RUN ./bootstrap -RUN dpkg-buildpackage -rfakeroot -b -uc -us -WORKDIR / -RUN mkdir -p /packages/gnunet -RUN mv /build/*.deb /packages/gnunet -RUN rm -rf /build -RUN dpkg -i /packages/gnunet/*.deb -WORKDIR / - -# Exchange -FROM gnunet as exchange - -COPY buildconfig/exchange.tag /buildconfig/ -WORKDIR /build -RUN TAG=$(cat /buildconfig/exchange.tag) && \ - git clone git://git.taler.net/exchange \ - --branch $TAG -WORKDIR /build/exchange -RUN ./bootstrap -RUN dpkg-buildpackage -rfakeroot -b -uc -us -WORKDIR / -RUN mkdir -p /packages/exchange -RUN mv /build/*.deb /packages/exchange -RUN rm -rf /build -RUN dpkg -i /packages/exchange/*.deb -WORKDIR / - -# Merchant -FROM exchange as merchant - -COPY buildconfig/merchant.tag /buildconfig/ -WORKDIR /build -RUN TAG=$(cat /buildconfig/merchant.tag) && \ - git clone git://git.taler.net/merchant \ - --branch $TAG -WORKDIR /build/merchant -RUN ./bootstrap -RUN dpkg-buildpackage -rfakeroot -b -uc -us -WORKDIR / -RUN mkdir -p /packages/merchant -RUN mv /build/*.deb /packages/merchant -RUN rm -rf /build -RUN dpkg -i /packages/merchant/*.deb -WORKDIR / - -# Libeufin -FROM base-system as libeufin - -WORKDIR /build -COPY buildconfig/libeufin.tag /buildconfig/ -RUN TAG=$(cat /buildconfig/libeufin.tag) && \ - git clone git://git.taler.net/libeufin \ - --branch $TAG -RUN apt-get install -y default-jre-headless -WORKDIR /build/libeufin -RUN ./bootstrap -RUN ./configure --prefix=/usr -RUN dpkg-buildpackage -rfakeroot -b -uc -us -WORKDIR / -RUN mkdir -p /packages/libeufin -RUN mv /build/*.deb /packages/libeufin -RUN rm -rf /build -RUN dpkg -i /packages/libeufin/*.deb - -# Merchant demos -FROM base-system as merchant-demos - -WORKDIR /build -COPY buildconfig/merchant-demos.tag /buildconfig/ -RUN TAG=$(cat /buildconfig/merchant-demos.tag) && \ - git clone git://git.taler.net/taler-merchant-demos \ - --branch $TAG -WORKDIR /build/taler-merchant-demos -RUN ./bootstrap -RUN dpkg-buildpackage -rfakeroot -b -uc -us -WORKDIR / -RUN mkdir -p /packages/merchant-demos -RUN mv /build/*.deb /packages/merchant-demos -RUN rm -rf /build -RUN dpkg -i /packages/merchant-demos/*.deb - -# wallet-core tools (taler-wallet-cli and taler-harness) -FROM base-system as wallet -WORKDIR /build -COPY buildconfig/wallet.tag /buildconfig/ -RUN TAG=$(cat /buildconfig/wallet.tag) && \ - git clone git://git.taler.net/wallet-core \ - --branch $TAG -RUN npm install -g pnpm@^8.7.0 -WORKDIR /build/wallet-core -RUN ./bootstrap -# taler-wallet-cli -WORKDIR /build/wallet-core/packages/taler-wallet-cli -RUN ./configure --prefix=/usr/local -RUN make deps -RUN dpkg-buildpackage -rfakeroot -b -uc -us -# taler-harness -WORKDIR /build/wallet-core/packages/taler-harness -RUN ./configure --prefix=/usr/local -RUN pnpm install --frozen-lockfile --filter @gnu-taler/taler-harness... -RUN pnpm run --filter @gnu-taler/taler-harness... compile -RUN dpkg-buildpackage -rfakeroot -b -uc -us -# copy debs -WORKDIR / -RUN mkdir -p /packages/wallet -RUN mv /build/wallet-core/packages/*.deb /packages/wallet -RUN rm -rf /build -RUN dpkg -i /packages/wallet/*.deb - -# Sync -FROM merchant as sync -COPY buildconfig/sync.tag /buildconfig/ -WORKDIR /build -RUN TAG=$(cat /buildconfig/sync.tag) && \ - git clone git://git.taler.net/sync \ - --branch $TAG -WORKDIR /build/sync -RUN ./bootstrap -RUN dpkg-buildpackage -rfakeroot -b -uc -us -WORKDIR / -RUN mkdir -p /packages/sync -RUN mv /build/*.deb /packages/sync -RUN rm -rf /build -RUN dpkg -i /packages/sync/*.deb -WORKDIR / - - -# Final image -FROM base-system as taler-final -COPY utils/fund-rewards.sh / -RUN apt-get update && apt-get -y upgrade && apt-get --no-install-recommends install -y \ - emacs \ - vim \ - postgresql \ - bash-completion \ - sudo \ - less -RUN mkdir -p /packages -COPY --from=gnunet /packages/gnunet/* /packages/ -COPY --from=exchange /packages/exchange/* /packages/ -COPY --from=merchant /packages/merchant/* /packages/ -COPY --from=wallet /packages/wallet/* /packages/ -COPY --from=libeufin /packages/libeufin/* /packages/ -COPY --from=merchant-demos /packages/merchant-demos/* /packages/ -RUN dpkg -i /packages/*.deb -RUN systemctl disable postgresql diff --git a/sandcastle/images/exchange/Dockerfile b/sandcastle/images/exchange/Dockerfile deleted file mode 100644 index 35979d0..0000000 --- a/sandcastle/images/exchange/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM taler_local/taler_base - -RUN mkdir -p /scripts -COPY scripts/* /scripts/ -RUN chmod +x /scripts/*.sh -ENTRYPOINT /scripts/startup.sh diff --git a/sandcastle/images/exchange/scripts/config.sh b/sandcastle/images/exchange/scripts/config.sh deleted file mode 100644 index e3e9a75..0000000 --- a/sandcastle/images/exchange/scripts/config.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# This script takes the deployment configuration from /config, -# generates the taler exchange specific configuration in /etc -# and sets some environment variables needed to properly -# run the exchange. - -set -o pipefail -set -eu - -export LD_LIBRARY_PATH=/usr/local/lib -export GNUNET_FORCE_LOG=";;;;WARNING" - -mkdir -p /etc/taler -TALERCONF=/etc/taler/taler.conf -cp /config/exchange/taler.conf $TALERCONF - -# Values from config file mounted at run time: -CURRENCY=`taler-config -c /config/deployment.conf -s taler-deployment -o currency` -EXCHANGE_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o default-exchange` - -EXCHANGE_BANK_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o exchange-bank-password` -EXCHANGE_IBAN=DE159593 -DB_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o db-password` - -sed -i "s;__EXCHANGE_URL__;${EXCHANGE_URL};" $TALERCONF -sed -i "s;__DB_PASSWORD__;${DB_PASSWORD};" $TALERCONF -sed -i "s/__CURRENCY__/${CURRENCY}/" $TALERCONF -sed -i "s/__EXCHANGE_BANK_PASSWORD__/${EXCHANGE_BANK_PASSWORD}/" $TALERCONF -sed -i "s/__EXCHANGE_IBAN__/${EXCHANGE_IBAN}/" $TALERCONF -sed -i "s;__BANK_URL__;http://bank:15000;" $TALERCONF - -# This is executed last since taler-exchange-offline already needs the config! - -EXCHANGE_MASTER_PUB=$(taler-exchange-offline -c $TALERCONF setup) -sed -i "s/__EXCHANGE_MASTER_PUB__/$EXCHANGE_MASTER_PUB/" $TALERCONF diff --git a/sandcastle/images/exchange/scripts/startup.sh b/sandcastle/images/exchange/scripts/startup.sh deleted file mode 100644 index d570be8..0000000 --- a/sandcastle/images/exchange/scripts/startup.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - -# -# Generate Taler ToS (Terms of Service) -# - - -TOS_PATH=/usr/local/share/taler/terms -TOS_AUTHOR="Taler Systems SA" -TOS_COPYRIGHT="Taler Systems SA" -TOS_LANGUAGE=en -TOS_OUTPUT=/usr/local/share/taler/terms/ -TOS_PAPER=a4 -TOS_TITLE="GNU Taler terms of service" - -# ToS generator is picky about the path that it is being run from -cd $TOS_PATH -taler-terms-generator -i exchange-tos-v0 -a $TOS_AUTHOR -C $TOS_COPYRIGHT -p $TOS_PAPER -o $TOS_OUTPUT -taler-terms-generator -i exchange-pp-v0 -a $TOS_AUTHOR -C $TOS_COPYRIGHT -p $TOS_PAPER -o $TOS_OUTPUT - -cd / - -source /scripts/config.sh - -while ! pg_isready -h talerdb -d taler; do - echo DB not ready yet. - sleep 2 -done -echo Now DB is ready. - -socat TCP-LISTEN:5555,fork,reuseaddr TCP:localhost:80 & - -echo -n "Init database... " -taler-exchange-dbinit -L WARNING -c $TALERCONF -echo DONE - -echo -n "Starting EDDSA helper..." -taler-exchange-secmod-eddsa -L WARNING \ - -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-exchange-secmod-eddsa-%Y-%m-%d.log 86400 & -echo DONE -echo -n "Starting RSA helper..." -taler-exchange-secmod-rsa -L WARNING \ - -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-exchange-secmod-rsa-%Y-%m-%d.log 86400 & -echo DONE -echo -n "Starting CS helper..." -taler-exchange-secmod-cs -L WARNING \ - -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-exchange-secmod-cs-%Y-%m-%d.log 86400 & -echo DONE - -echo -n "Launching exchange HTTPD..." -taler-exchange-httpd -L WARNING -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-exchange-httpd-%Y-%m-%d.log 86400 & -for n in `seq 1 50` - do - echo "." - sleep 0.3 - OK=1 - wget $EXCHANGE_URL -t 1 -o /dev/null -O /dev/null >/dev/null && break - OK=0 - done - if [ 1 != $OK ] - then - echo "ERROR: failed to launch Exchange" - exit 1 - fi -echo DONE - -echo -n "Launching wirewatch..." -taler-exchange-wirewatch -L WARNING --longpoll-timeout=2s -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-exchange-wirewatch-%Y-%m-%d.log 86400 & -echo DONE -echo -n "Launching transfer service..." -taler-exchange-transfer -L WARNING -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-exchange-transfer-%Y-%m-%d.log 86400 & -echo DONE -echo -n "Launching aggregator service..." -taler-exchange-aggregator -L WARNING -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-exchange-aggregator-%Y-%m-%d.log 86400 & -echo DONE -echo -echo -n "Setup keys and fees with taler-exchange-offline..." -taler-exchange-offline -L WARNING -c $TALERCONF \ - download sign \ - enable-account "payto://iban/SANDBOXX/${EXCHANGE_IBAN}?receiver-name=Exchange+Company" \ - wire-fee now iban ${CURRENCY}:0.01 ${CURRENCY}:0.01 \ - global-fee now ${CURRENCY}:0 ${CURRENCY}:0 ${CURRENCY}:0 1h 1year 5 \ - upload 2>&1 -echo DONE - -echo -n "Requesting exchange's /keys..." -curl --max-time 4 -s "${EXCHANGE_URL}keys" -echo DONE - -# Spawn a process that will fail after an hour, -# to facilitate restarting every hour. -( sleep 3600 && exit 1) & - -# Exit once a single process fails. -# Then, docker-compose will restart the whole container. -wait -n diff --git a/sandcastle/images/libeufin/Dockerfile b/sandcastle/images/libeufin/Dockerfile deleted file mode 100644 index 99745aa..0000000 --- a/sandcastle/images/libeufin/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM taler_local/taler_base - -COPY startup.sh / -COPY demobank-ui-settings.js /usr/local/share/taler/demobank-ui/ -RUN chmod +x /startup.sh -COPY nginx.conf / - -ENTRYPOINT ["/startup.sh"] diff --git a/sandcastle/images/libeufin/demobank-ui-settings.js b/sandcastle/images/libeufin/demobank-ui-settings.js deleted file mode 100644 index 7f2745c..0000000 --- a/sandcastle/images/libeufin/demobank-ui-settings.js +++ /dev/null @@ -1,19 +0,0 @@ -globalThis.talerDemobankSettings = { - allowRegistrations: true, - bankName: "Taler Bank", - // Show explainer text and navbar to other demo sites - showDemoNav: true, - // Names and links for other demo sites to show in the navbar - demoSites: [ - ["Landing", "__LANDING_URL__"], - ["Bank", "__BANK_WEBUI_URL__"], - ["Essay Shop", "__BLOG_URL__"], - ["Donations", "__DONATIONS_URL__"], - ["Survey", "__SURVEY_URL__"], - ], - bankBaseUrl: "__BANK_BACKEND_URL__" -}; - -// Currently this is still required by demobank-ui, -// the above, nicer method doesn't work yet. -localStorage.setItem("bank-base-url", "__BANK_BACKEND_URL__") diff --git a/sandcastle/images/libeufin/nginx.conf b/sandcastle/images/libeufin/nginx.conf deleted file mode 100644 index d5436f5..0000000 --- a/sandcastle/images/libeufin/nginx.conf +++ /dev/null @@ -1,14 +0,0 @@ -error_log /dev/stdout; -daemon off; -events {} -http { - access_log /dev/stdout; - server { - include /etc/nginx/mime.types; - listen 80; - listen [::]:80; - location / { - root /usr/local/share/taler/demobank-ui; - } - } -} diff --git a/sandcastle/images/libeufin/startup.sh b/sandcastle/images/libeufin/startup.sh deleted file mode 100644 index 2238523..0000000 --- a/sandcastle/images/libeufin/startup.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -set -o pipefail -set -eu - -export JAVA_OPTS="-Xss4m -XX:MaxJavaStackTraceDepth=1073741823" - -# helps taler-config -export LD_LIBRARY_PATH=/usr/local/lib - -mkdir -p /etc/taler/ -TALERCONF=/etc/taler/taler.conf -cp /config/libeufin-bank/taler.conf $TALERCONF - -CURRENCY=$(taler-config -c /config/deployment.conf -s taler-deployment -o currency) -EXCHANGE_IBAN=DE159593 -DB_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o db-password` - -sed -i "s;__DB_PASSWORD__;${DB_PASSWORD};" $TALERCONF -sed -i "s/__CURRENCY__/${CURRENCY}/" $TALERCONF - -# takes port and service name -is_serving() { - echo Is $1 serving? - for n in `seq 1 80` - do - echo "." - sleep 0.1 - OK=1 - wget $1 -o /dev/null -O /dev/null >/dev/null && break - OK=0 - done - if [ 1 != $OK ] - then - echo "$2 unreachable." - exit 1 - fi - echo $2 reachable. -} - -BANK_SIGNUP_BONUS=$(taler-config -c /config/deployment.conf -s taler-deployment -o bank-signup-bonus) -BANK_ALLOW_REGISTRATIONS=$(taler-config -c /config/deployment.conf -s taler-deployment -o bank-allow-registrations) - -case "${1:-}" in - shell) - echo "Starting interactive shell" - exec bash - ;; - *) - ;; -esac - -echo "running libeufin-bank dbinit" -libeufin-bank dbinit - -echo "running libeufin-bank serve in background" -libeufin-bank serve & - -is_serving http://localhost:15000/config libeufin-bank - -EXCHANGE_IBAN=DE159593 -BLOG_IBAN=DE940993 -GNUNET_IBAN=DE463312 -DEFAULT_IBAN=DE474361 -TOR_IBAN=DE358263 -TALER_IBAN=DE102893 -SURVEY_IBAN=DE731371 - -EXCHANGE_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o exchange-bank-password` -POS_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o pos-bank-password` -BLOG_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o blog-bank-password` -GNUNET_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o gnunet-bank-password` -DEFAULT_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o default-bank-password` -TOR_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o tor-bank-password` -TALER_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o taler-bank-password` -SURVEY_SANDBOX_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o survey-bank-password` - -req=$(jq -n ' - { - username: "exchange", - password: $PW, - name: "exchange", - is_public: true, - is_taler_exchange: true, - internal_payto_uri: $PAYTO, - }' \ - --arg PW $EXCHANGE_SANDBOX_PASSWORD \ - --arg PAYTO "payto://iban/$EXCHANGE_IBAN" - ) -echo $req -curl -v -X POST -H "Content-Type: application/json" --data "$req" http://localhost:15000/accounts - - -# starting the SPA -BLOG_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o blog-url` -DONATIONS_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o donations-url` -SURVEY_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o survey-url` -LANDING_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o landing-url` -BANK_WEBUI_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o bank-url` -BANK_BACKEND_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o bank-backend-url` - -sed -i "s;__LANDING_URL__;${LANDING_URL};" /usr/local/share/taler/demobank-ui/demobank-ui-settings.js -sed -i "s;__BLOG_URL__;${BLOG_URL};" /usr/local/share/taler/demobank-ui/demobank-ui-settings.js -sed -i "s;__DONATIONS_URL__;${DONATIONS_URL};" /usr/local/share/taler/demobank-ui/demobank-ui-settings.js -sed -i "s;__SURVEY_URL__;${SURVEY_URL};" /usr/local/share/taler/demobank-ui/demobank-ui-settings.js -sed -i "s;__BANK_WEBUI_URL__;${BANK_WEBUI_URL};" /usr/local/share/taler/demobank-ui/demobank-ui-settings.js -sed -i "s;__BANK_BACKEND_URL__;${BANK_BACKEND_URL};" /usr/local/share/taler/demobank-ui/demobank-ui-settings.js -# Serves BANK_WEBUI_URL -nginx -c /nginx.conf 2>&1 | rotatelogs -e /logs/bank-ui-%Y-%m-%d.log 86400 & - -echo "Launched bank services" - -# -n makes 'wait' return as soon as one of the background -# processes exits. That triggers then the 'restart: always' -# policy set in the compose file. -wait -n diff --git a/sandcastle/images/merchant/Dockerfile b/sandcastle/images/merchant/Dockerfile deleted file mode 100644 index feffada..0000000 --- a/sandcastle/images/merchant/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM taler_local/taler_base - -COPY startup.sh / -COPY create_instances.sh / -COPY update_instances_auth.sh / -RUN chmod +x /startup.sh -ENTRYPOINT /startup.sh diff --git a/sandcastle/images/merchant/create_instances.sh b/sandcastle/images/merchant/create_instances.sh deleted file mode 100644 index c3b9adf..0000000 --- a/sandcastle/images/merchant/create_instances.sh +++ /dev/null @@ -1,45 +0,0 @@ -function die() { - echo $1 - exit 1 -} -function create_instance() { - echo -n "Creating merchant backend instance $1 with IBAN $2..." - NAME=$1 - IBAN=$2 - RECV_NAME=$3 - URI='payto://iban/SANDBOXX/'$IBAN'?receiver-name='$RECV_NAME - REQ="$(jq -n ' - { - auth: { method: "token", "token": $TOKEN }, - payto_uris: [$URI], - accounts: [{payto_uri: $URI}], - id: $NAME, - name: "GNU Taler", - address: {}, - jurisdiction: {}, - use_stefan: true, - default_wire_transfer_delay: {d_us: 1}, - default_pay_delay: {d_us: 3600000000}, - }' \ - --arg URI "$URI" \ - --arg TOKEN "$BACKEND_APIKEY" \ - --arg CURRENCY "$CURRENCY" \ - --arg NAME "$NAME" - )" - - curl --silent --show-error \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $BACKEND_APIKEY" \ - -X POST \ - -d "$REQ" \ - http://merchant/management/instances || die "instance creation failed" - echo DONE -} - -create_instance default "$DEFAULT_IBAN" TestMerchant -create_instance pos "$POS_IBAN" PoS -create_instance blog "$BLOG_IBAN" BlogCompany -create_instance GNUnet "$GNUNET_IBAN" GNUnet -create_instance Taler "$TALER_IBAN" Taler -create_instance Tor "$TOR_IBAN" Tor -create_instance survey "$SURVEY_IBAN" Survey diff --git a/sandcastle/images/merchant/startup.sh b/sandcastle/images/merchant/startup.sh deleted file mode 100644 index c33121a..0000000 --- a/sandcastle/images/merchant/startup.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash - -set -o pipefail -set -eu - -export LD_LIBRARY_PATH=/usr/local/lib -export GNUNET_FORCE_LOG=";;;;WARNING" - -mkdir -p /etc/taler -TALERCONF=/etc/taler/taler.conf -cp /config/merchant/taler.conf $TALERCONF - -# Values from config file mounted at run time: -CURRENCY=`taler-config -c /config/deployment.conf -s taler-deployment -o currency` -BACKEND_APIKEY=`taler-config -c /config/deployment.conf -s taler-deployment -o merchant-apikey` -BACKEND_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o merchant-url` -SYNC_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o sync-url` -EXCHANGE_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o default-exchange` -DB_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o db-password` - -BLOG_IBAN=DE940993 -POS_IBAN=DE445094 -GNUNET_IBAN=DE463312 -DEFAULT_IBAN=DE474361 -TOR_IBAN=DE358263 -TALER_IBAN=DE102893 -SURVEY_IBAN=DE731371 - -while ! pg_isready -h talerdb -d taler; do - echo DB not ready yet. - sleep 2 -done -echo Now DB is ready. - -# FIXME: wallets external to the containers put localhost'ed -# exchanges along a /pay request. That breaks here, since the -# exchange listens from another container. The following -# command routes every request to 5555 (port on the host -# system that points to a contained exchange AND where the -# merchant tries to /deposit), to the container where the exchange listens. -socat TCP-LISTEN:5555,fork,reuseaddr TCP:exchange:80 & - -# FIXME: browsers can only get redirected to merchant backends -# as they appear outside of the container (port 5556). OTOH, -# merchant frontends can only talk to backends as they appear -# _inside_ the container (port 80). Config, ultimately, must -# specify backends as they appear outside, otherwise frontends -# would redirect browsers with in-container addresses, that -# would make the backend not reached. The following redirection -# allows to bridge the external merchant port to the internal, -# to make frontends reach the backend. -socat TCP-LISTEN:5556,fork,reuseaddr TCP:localhost:80 & - -# sync HTTPD redirect: -socat TCP-LISTEN:5563,fork,reuseaddr TCP:localhost:8080 & - -# $2 might have Authorization header. -is_serving () { -set +u # tolerate missing $2 -echo Checking $1 -for n in `seq 1 50` - do - echo "." - sleep 0.5 - OK=1 - # auth case. - if test -n "$2"; then - wget --header "$2" $1 -t 1 -o /dev/null -O /dev/null >/dev/null && break - else - wget $1 -t 1 -o /dev/null -O /dev/null >/dev/null && break - fi - OK=0 - done - if [ 1 != $OK ] - then - echo "ERROR: $1 unreachable." - exit 1 - fi - echo Now available: $1 - set -u -} - -is_serving ${EXCHANGE_URL} - -EXCHANGE_MASTER_PUB=$(curl -s ${EXCHANGE_URL}keys | jq -r .master_public_key) -echo Found Exchange Pub: $EXCHANGE_MASTER_PUB -sed -i "s;__EXCHANGE_URL__;${EXCHANGE_URL};" $TALERCONF -sed -i "s/__EXCHANGE_PUB__/${EXCHANGE_MASTER_PUB}/" $TALERCONF -sed -i "s/__CURRENCY__/${CURRENCY}/" $TALERCONF -sed -i "s/__BACKEND_APIKEY__/${BACKEND_APIKEY}/" $TALERCONF -sed -i "s;__BACKEND_URL__;${BACKEND_URL};" $TALERCONF -sed -i "s;__DB_PASSWORD__;${DB_PASSWORD};" $TALERCONF - -echo "Init database... " -taler-merchant-dbinit -L WARNING -c $TALERCONF -echo DONE -echo -n "Launch merchant backend..." -taler-merchant-httpd -L WARNING -a $BACKEND_APIKEY -c $TALERCONF 2>&1 | \ - rotatelogs -e /logs/taler-merchant-httpd-%Y-%m-%d.log 86400 & -echo DONE -sleep 1 - -is_serving "${BACKEND_URL}config" - -# If the witness instance exists or has wrong auth, -# then all the others do. -echo -n "Checking instances existence..." -INSTANCES_STATUS=$(curl -s -o /dev/null \ - -w "%{http_code}" \ - -H "Authorization: Bearer $BACKEND_APIKEY" \ - "${BACKEND_URL}instances/Taler/private") -echo "DONE ($INSTANCES_STATUS)" - -case $INSTANCES_STATUS in - "404") - echo "Taler (witness) instance not found, assuming none is." - source /create_instances.sh; - ;; - "401") - echo "Taler (witness) instance had wrong auth, assuming API key is new." - source /update_instances_auth.sh; - ;; - *) - echo "Taler (witness) instance found, API key correct, do nothing." - ;; -esac -export TALER_ENV_URL_MERCHANT_BLOG=`taler-config -c /config/deployment.conf -s taler-deployment -o blog-url` -export TALER_ENV_URL_MERCHANT_DONATIONS=`taler-config -c /config/deployment.conf -s taler-deployment -o donations-url` -export TALER_ENV_URL_MERCHANT_SURVEY=`taler-config -c /config/deployment.conf -s taler-deployment -o survey-url` -export TALER_ENV_URL_INTRO=`taler-config -c /config/deployment.conf -s taler-deployment -o landing-url` -export TALER_ENV_URL_BANK=`taler-config -c /config/deployment.conf -s taler-deployment -o bank-url` - -echo -n "Launch blog..." -taler-merchant-demos -c $TALERCONF --http-port 8080 blog 2>&1 | rotatelogs -e /logs/blog-%Y-%m-%d.log 86400 & -echo DONE -echo -n "Launch donations..." -taler-merchant-demos -c $TALERCONF --http-port 8081 donations 2>&1 | rotatelogs -e /logs/donations-%Y-%m-%d.log 86400 & -echo DONE -echo -n "Launch Survey..." -taler-merchant-demos -c $TALERCONF --http-port 8082 survey 2>&1 | rotatelogs -e /logs/survey-%Y-%m-%d.log 86400 & -echo DONE -echo -n "Launch Landing..." -taler-merchant-demos -c $TALERCONF --http-port 8083 landing 2>&1 | rotatelogs -e /logs/landing-%Y-%m-%d.log 86400 & -echo DONE - -wait -n diff --git a/sandcastle/images/merchant/update_instances_auth.sh b/sandcastle/images/merchant/update_instances_auth.sh deleted file mode 100644 index b1ab8a6..0000000 --- a/sandcastle/images/merchant/update_instances_auth.sh +++ /dev/null @@ -1,18 +0,0 @@ -echo -n "Change pos auth..." -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}' http://merchant/management/instances/pos/auth -echo DONE -echo -n "Change blog auth..." -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}' http://merchant/management/instances/blog/auth -echo DONE -echo -n "Change GNUnet auth..." -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}' http://merchant/management/instances/GNUnet/auth -echo DONE -echo -n "Change Taler auth..." -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}' http://merchant/management/instances/Taler/auth -echo DONE -echo -n "Change Tor auth..." -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}' http://merchant/management/instances/Tor/auth -echo DONE -echo -n "Change survey auth..." -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BACKEND_APIKEY" -X POST -d '{"method":"token", "token":"'$BACKEND_APIKEY'"}' http://merchant/management/instances/survey/auth -echo DONE diff --git a/sandcastle/images/postgres/Dockerfile b/sandcastle/images/postgres/Dockerfile deleted file mode 100644 index d0fde23..0000000 --- a/sandcastle/images/postgres/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM docker.io/postgres - -# Default "${PGDATA}/log" directory was problematic -# when mounted in a volume. Prefer arbitrary "/logs". -RUN mkdir /logs -RUN chown postgres:postgres /logs - -COPY init.sh /docker-entrypoint-initdb.d/init.sh -RUN chmod +x /docker-entrypoint-initdb.d/init.sh diff --git a/sandcastle/images/postgres/init.sh b/sandcastle/images/postgres/init.sh deleted file mode 100644 index d0cdacf..0000000 --- a/sandcastle/images/postgres/init.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -eu - -# FIXME: use taler-config. -CUSTOM_PASSWORD=$(grep ^db-password < /config/deployment.conf | awk -F= '{print $2}' | tr -d "[:space:]") -if test -z "${CUSTOM_PASSWORD}"; then - echo ERROR: database password empty. -fi -echo "ALTER ROLE root WITH PASSWORD '"${CUSTOM_PASSWORD}"';" | psql -U root -createdb -U root -O root taler -echo "ALTER SYSTEM SET logging_collector TO 'true';" | psql -U root -echo "ALTER SYSTEM SET log_directory TO '/logs';" | psql -U root -echo "ALTER SYSTEM SET log_filename TO 'postgres-%Y-%m-%d.log';" | psql -U root -pg_ctl restart diff --git a/sandcastle/images/woocommerce/Dockerfile b/sandcastle/images/woocommerce/Dockerfile deleted file mode 100644 index 0d16df7..0000000 --- a/sandcastle/images/woocommerce/Dockerfile +++ /dev/null @@ -1,99 +0,0 @@ -FROM debian:bullseye - -# This file is in the public domain. - -LABEL docker-woocommerce.demo.taler.net="0.0.1-beta" -RUN echo "avoid docker cache..." - -EXPOSE 9001 - -WORKDIR /root/ - -COPY tags.conf . -COPY entry-point.sh . - -# Install dependencies - - -RUN apt-get update && apt-get install -y \ - software-properties-common \ - ca-certificates \ - lsb-release \ - apt-transport-https \ - wget \ - curl \ - git \ - unzip \ - gnupg \ - nginx - -RUN sh -c 'echo "deb https://packages.sury.org/php/ bullseye main" > /etc/apt/sources.list.d/php.list' - -RUN wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - - -RUN apt-get update - -RUN . /root/tags.conf \ - && apt-get install \ - php${PHP_VERSION} \ - php${PHP_VERSION}-common \ - php${PHP_VERSION}-mbstring \ - php${PHP_VERSION}-xmlrpc \ - php${PHP_VERSION}-soap \ - php${PHP_VERSION}-gd \ - php${PHP_VERSION}-xml \ - php${PHP_VERSION}-intl \ - php${PHP_VERSION}-mysql \ - php${PHP_VERSION}-cli \ - php${PHP_VERSION}-ldap \ - php${PHP_VERSION}-zip \ - php${PHP_VERSION}-curl\ - php${PHP_VERSION}-zip \ - php${PHP_VERSION}-fpm -y - -# Download Wordpress, plugins and theme + extract - -RUN . /root/tags.conf \ - && mkdir -p /var/www/wordpress/wp-content/plugins \ - && mkdir -p /var/www/wordpress/wp-content/themes \ - && wget https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \ - && tar -xzf wordpress-${WORDPRESS_VERSION}.tar.gz -C /var/www/ \ - && wget https://downloads.wordpress.org/plugin/woocommerce.${WOOCOMMERCE_VERSION}.zip \ - && unzip woocommerce.${WOOCOMMERCE_VERSION}.zip -d /var/www/wordpress/wp-content/plugins \ - && wget https://downloads.wordpress.org/theme/ecommerce-star.${WORDPRESS_PARENT_THEME_VERSION}.zip \ - && unzip ecommerce-star.${WORDPRESS_PARENT_THEME_VERSION}.zip -d /var/www/wordpress/wp-content/themes \ - && wget https://downloads.wordpress.org/theme/shop-here.${WORDPRESS_CHILD_THEME_VERSION}.zip \ - && unzip shop-here.${WORDPRESS_CHILD_THEME_VERSION}.zip -d /var/www/wordpress/wp-content/themes \ - && wget https://downloads.wordpress.org/plugin/gnu-taler-payment-for-woocommerce.zip \ - && unzip gnu-taler-payment-for-woocommerce.zip -d /var/www/wordpress/wp-content/plugins - -# Install wp-cli - -RUN wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ - && chmod +x wp-cli.phar \ - && mv wp-cli.phar /usr/local/bin/wp - - -RUN chown -R www-data:www-data /var/www/wordpress - -# Remove downloads from root directory - -RUN rm -Rf /root/*.zip - -# Copy nginx configuration from host, to container - -COPY woocommerce.conf /etc/nginx/sites-available - -RUN ln -s /etc/nginx/sites-available/woocommerce.conf /etc/nginx/sites-enabled/woocommerce.conf \ - && rm /etc/nginx/sites-enabled/default - - -# Execute entrypoint - -RUN chmod +x entry-point.sh - -ENTRYPOINT /root/entry-point.sh - -# Additional steps after entrypoint. - -#CMD ["nginx", "-g", "daemon off;"] diff --git a/sandcastle/images/woocommerce/docker-compose.yml b/sandcastle/images/woocommerce/docker-compose.yml deleted file mode 100644 index 63850d6..0000000 --- a/sandcastle/images/woocommerce/docker-compose.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: '3' -services: - db: - image: mariadb - environment: - MARIADB_DATABASE: exampledb - MYSQL_USER: wordpress_user - MYSQL_PASSWORD: wordpress_password - MYSQL_RANDOM_ROOT_PASSWORD: "1" - volumes: - - mariadb_data:/var/lib/mysql - wordpress: - build: images/woocommerce - image: woo - container_name: woocommerce_taler - depends_on: - - db - ports: - - "9001:80" - environment: - WORDPRESS_DB_HOST: db:3306 - WORDPRESS_DB_USER: wordpress_user - WORDPRESS_DB_PASSWORD: wordpress_password - WORDPRESS_DB_NAME: exampledb - WORDPRESS_TABLE_PREFIX: "wp_" - WORDPRESS_DEBUG: 1 - volumes: - - wp_data:/var/www/wordpress - - /home/jj/final-woocommerce-docker/nginx-conf:/etc/nginx/conf.d - wordpress-cli: - container_name: wp_cli - #entrypoint: wordpress - depends_on: - - db - - wordpress - volumes: - - wp_data:/var/www/wordpress - image: wordpress:cli - links: - - db:db - working_dir: /var/www/wordpress - user: "33" - command: wp core install --path="/var/www/wordpress" --url="http://woocommerce.valenciatech.com" --title=gnu-taler --admin_user=admin --admin_password=admin --admin_email=your-email-here -volumes: - wp_data: - mariadb_data: diff --git a/sandcastle/images/woocommerce/entry-point.sh b/sandcastle/images/woocommerce/entry-point.sh deleted file mode 100755 index d954d78..0000000 --- a/sandcastle/images/woocommerce/entry-point.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -source /root/tags.conf - -# Import the whole database (if wp-cli works, this wont be necessary) - -#mysql -u ${MARIADB_USER} -p${MARIADB_PASSWORD} ${MARIADB_DATABASE_NAME} < woocommerce.sql - -# Rename wordpress config file - -mv /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php - -# Replace values database connection - -# Replace values with .env VARIABLES - -sed -ie "s/database_name_here/${WORDPRESS_DATABASE_NAME}/g" /var/www/wordpress/wp-config.php \ - && sed -ie "s/username_here/${WORDPRESS_DATABASE_USER}/g" /var/www/wordpress/wp-config.php \ - && sed -ie "s/password_here/${WORDPRESS_DATABASE_PASSWORD}/g" /var/www/wordpress/wp-config.php \ - && sed -ie "s/localhost/${WORDPRESS_DATABASE_HOST}/g" /var/www/wordpress/wp-config.php - - -# Install WP (either do it here, or through the docker-compose.yml). - -#wp core install --allow-root --url=test.woocommerce.taler.net --title=GNU Taler for WooCommerce --admin_user=admin --admin_password=admin --admin_email=info@example.com - -# Enable theme shop-here - -#wp theme enable shop-here - -# Activate Woocommerce plugin - -#wp plugin activate woocommerce - -# Activate GNU Taler plugin - -#wp plugin activate gnu-taler-payment-for-woocommerce - -# Import products into database - -#wp import /woocommerce-products-backup.xml --authors=create - -service nginx start - -service php${PHP_VERSION}-fpm start - - -while true; do - sleep 100; - done diff --git a/sandcastle/images/woocommerce/tags.conf b/sandcastle/images/woocommerce/tags.conf deleted file mode 100644 index 2ac9d96..0000000 --- a/sandcastle/images/woocommerce/tags.conf +++ /dev/null @@ -1,21 +0,0 @@ - -# Software versions - -PHP_VERSION="8.2" -WOOCOMMERCE_VERSION="7.1.1" -WORDPRESS_VERSION="6.1" -WORDPRESS_PARENT_THEME_VERSION="1.3.9" -WORDPRESS_CHILD_THEME_VERSION="1.0.2" - -# MariaDB credentials (just in case) - -MARIADB_USER="wordpress_user" -MARIADB_PASSWORD="wordpress_password" -MARIADB_DATABASE_NAME="exampledb" - -# Database connection details - -WORDPRESS_DATABASE_NAME="exampledb" -WORDPRESS_DATABASE_USER="wordpress_user" -WORDPRESS_DATABASE_PASSWORD="wordpress_password" -WORDPRESS_DATABASE_HOST="db" diff --git a/sandcastle/images/woocommerce/woocommerce.conf b/sandcastle/images/woocommerce/woocommerce.conf deleted file mode 100644 index b560802..0000000 --- a/sandcastle/images/woocommerce/woocommerce.conf +++ /dev/null @@ -1,47 +0,0 @@ -# Upstream to abstract backend connection(s) for php -upstream php { - server unix:/var/run/php/php8.2-fpm.sock; - server 127.0.0.1:9000; -} - -server { - listen 80; - server_name _; - ## Your website name goes here. - # server_name woocommerce.valenciatech.cloud; - ## Your only path reference. - root /var/www/wordpress; - ## This should be in your http block and if it is, it's not needed here. - index index.php; - - location = /favicon.ico { - log_not_found off; - access_log off; - } - - location = /robots.txt { - allow all; - log_not_found off; - access_log off; - } - - location / { - # This is cool because no php is touched for static content. - # include the "?$args" part so non-default permalinks doesn't break when using query string - try_files $uri $uri/ /index.php?$args; - } - - location ~ \.php$ { - #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini - include fastcgi_params; - fastcgi_intercept_errors on; - fastcgi_pass php; - #The following parameter can be also included in fastcgi_params file - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - } - - location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { - expires max; - log_not_found off; - } -} |