summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2023-10-17 01:34:54 +0200
committerAndreas Fankhauser hiddenalpha.ch2023-10-17 01:34:54 +0200
commit52b257d55141ce498f890b49b5092caccc256e6d (patch)
tree11bd7b048c16f3709684423fdbb76fe15566f0bf
parent592e97ce53e944a04e92a0b49d5f8725684805cc (diff)
downloadUnspecifiedGarbage-52b257d55141ce498f890b49b5092caccc256e6d.zip
UnspecifiedGarbage-52b257d55141ce498f890b49b5092caccc256e6d.tar.gz
(qemu) Migrate gateleen from docker to qemu
-rw-r--r--doc/note/qemu/build-gateleen.txt69
-rw-r--r--src/main/docker/gateleen.Dockerfile65
2 files changed, 69 insertions, 65 deletions
diff --git a/doc/note/qemu/build-gateleen.txt b/doc/note/qemu/build-gateleen.txt
new file mode 100644
index 0000000..77dcab8
--- /dev/null
+++ b/doc/note/qemu/build-gateleen.txt
@@ -0,0 +1,69 @@
+
+
+### Alpine
+true \
+ && PKGS_TO_ADD="curl maven nodejs npm redis openjdk11-jre-headless" \
+ && SUDO="${HOME:?}/.local/bin/mysudo" \
+ && PKGINIT=true \
+ && PKGADD="$SUDO apk add" \
+ && PKGCLEAN=true \
+ && true
+
+
+### Generic
+true \
+ && GATELEEN_GIT_TAG="v1.3.28" \
+ && WORKDIR="/${HOME:?}/work" \
+ && CACHE_DIR="/var/tmp" \
+ && true
+
+
+## Setup Dependencies & get sources
+true \
+ && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \
+ \
+ && curl -sSL https://github.com/swisspush/gateleen/archive/refs/tags/"${GATELEEN_GIT_TAG:?}".tar.gz > "${CACHE_DIR:?}/gateleen-${GATELEEN_GIT_TAG:?}.tgz" \
+ && true
+
+
+### Make
+true \
+ && mkdir -p "${WORKDIR:?}/gateleen" && cd "${WORKDIR:?}/gateleen" \
+ && tar --strip-components 1 -xf "${CACHE_DIR:?}/gateleen-${GATELEEN_GIT_TAG:?}.tgz" \
+ && (cd gateleen-hook-js && npm install) \
+ && mkdir -p gateleen-hook-js/node/node_modules/npm/bin \
+ && ln -s /usr/bin/node gateleen-hook-js/node/node \
+ && printf "require('/usr/lib/node_modules/npm/lib/cli.js')\n" | tee gateleen-hook-js/node/node_modules/npm/bin/npm-cli.js >/dev/null \
+ && mvn install -PpublicRepos -DskipTests -Dskip.installnodenpm -pl gateleen-hook-js \
+ && mvn install -PpublicRepos -DfailIfNoTests=false \
+ -pl !gateleen-test,!gateleen-hook-js \
+ -Dtest=!ReleaseLockLuaScriptTests,!RedisCacheStorageTest,!DeltaHandlerTest,!QueueCircuitBreakerCloseCircuitLuaScriptTests,!QueueCircuitBreakerGetAllCircuitsLuaScriptTests,!QueueCircuitBreakerHalfOpenCircuitsLuaScriptTests,!QueueCircuitBreakerReOpenCircuitLuaScriptTests,!QueueCircuitBreakerUpdateStatsLuaScriptTests,!RemoveExpiredQueuesLuaScriptTests,!StartQueueTimerLuaScriptTests \
+ && mkdir "${WORKDIR:?}/classpath" \
+ && (cd gateleen-playground && mvn dependency:copy-dependencies \
+ -DexcludeScope=provided -DoutputDirectory="${WORKDIR:?}/classpath/.") \
+ && cp gateleen-playground/target/gateleen-playground-*.jar "${WORKDIR:?}/classpath/." \
+ && mkdir "${WORKDIR:?}/etc" "${WORKDIR:?}/redis-state" \
+ && printf >"${WORKDIR:?}/etc/redis.conf" '%s\n' \
+ 'save ""' \
+ 'appendonly yes' \
+ 'appendfilename appendonly.aof' \
+ && `# Squeeze those funny "static files" into redis` \
+ && (cd "${WORKDIR:?}/redis-state" && redis-server "${WORKDIR:?}/etc/redis.conf" \
+ & java -cp "${WORKDIR:?}/classpath/"'*' org.swisspush.gateleen.playground.Server \
+ & sleep 3 \
+ ) \
+ && (cd "${WORKDIR:?}/gateleen" && mvn deploy -PuploadStaticFiles) \
+ && pkill -TERM java && pkill -INT redis-server \
+ && $PKGDEL $PKGS_TO_DEL \
+ && $PKGCLEAN \
+ && printf '\n DONE\n\n' \
+ && true
+
+
+### Run
+true \
+ && ip a | grep inet \
+ && (cd "${WORKDIR:?}/redis-state" && redis-server "${WORKDIR:?}/etc/redis.conf") \
+ & java -cp "${WORKDIR:?}/classpath/"'*' org.swisspush.gateleen.playground.Server \
+ && true
+
diff --git a/src/main/docker/gateleen.Dockerfile b/src/main/docker/gateleen.Dockerfile
deleted file mode 100644
index f604dc2..0000000
--- a/src/main/docker/gateleen.Dockerfile
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# A Gateleen playground instance.
-#
-
-ARG PARENT_IMAGE=alpine:3.16.0
-FROM $PARENT_IMAGE
-
-ARG GATELEEN_GIT_TAG=v1.3.28
-ARG UID=1000
-ARG GID=1000
-ARG PKGS_TO_ADD="maven nodejs npm curl redis openjdk11-jre-headless"
-#ARG PKGS_TO_DEL="maven nodejs npm"
-ARG PKGS_TO_DEL="nodejs npm"
-ARG PKGINIT="true"
-ARG PKGADD="apk add"
-ARG PKGDEL="true"
-ARG PKGCLEAN="true"
-
-WORKDIR /work
-
-RUN true \
- && printf 'user:x:%s:%s:user:/work:/bin/sh\n' "${UID:?}" "${GID:?}" >> /etc/passwd \
- && true
-
-RUN true \
- && $PKGINIT && $PKGADD $PKGS_TO_ADD \
- && sed -i "s,</settings>, <localRepository>/data/maven/.m2/repository</localRepository>\n</settings>,g" /usr/share/java/maven-3/conf/settings.xml \
- && mkdir /data /data/maven /work/gateleen \
- && chown "${UID:?}:${GID:?}" /data/maven /work /work/gateleen \
- && curl -sSL https://github.com/swisspush/gateleen/archive/refs/tags/"$GATELEEN_GIT_TAG".tar.gz > "/tmp/gateleen-$GATELEEN_GIT_TAG.tgz" \
- && cd /work/gateleen \
- && su user -c 'tar --strip-components 1 -xf /tmp/gateleen-"$GATELEEN_GIT_TAG".tgz' \
- && (cd gateleen-hook-js && su user -c 'npm install') \
- && su user -c 'mkdir -p gateleen-hook-js/node/node_modules/npm/bin' \
- && su user -c 'ln -s /usr/bin/node gateleen-hook-js/node/node' \
- && printf "require('/usr/lib/node_modules/npm/lib/cli.js')\n" | su user -c 'tee gateleen-hook-js/node/node_modules/npm/bin/npm-cli.js' >/dev/null \
- && su user -c 'mvn install -PpublicRepos -DskipTests -Dskip.installnodenpm -pl gateleen-hook-js' \
- && su user -c 'mvn install -PpublicRepos -DfailIfNoTests=false \
- -pl !gateleen-test,!gateleen-hook-js \
- -Dtest=!ReleaseLockLuaScriptTests,!RedisCacheStorageTest,!DeltaHandlerTest,!QueueCircuitBreakerCloseCircuitLuaScriptTests,!QueueCircuitBreakerGetAllCircuitsLuaScriptTests,!QueueCircuitBreakerHalfOpenCircuitsLuaScriptTests,!QueueCircuitBreakerReOpenCircuitLuaScriptTests,!QueueCircuitBreakerUpdateStatsLuaScriptTests,!RemoveExpiredQueuesLuaScriptTests,!StartQueueTimerLuaScriptTests' \
- && mkdir /work/classpath \
- && chown "${UID:?}:${GID:?}" /work/classpath \
- && su user -c 'cd gateleen-playground && mvn dependency:copy-dependencies \
- -DexcludeScope=provided -DoutputDirectory=/work/classpath/.' \
- && cp gateleen-playground/target/gateleen-playground-*.jar /work/classpath/. \
- && mkdir /work/etc \
- && printf >/work/etc/redis.conf '%s\n' \
- 'save ""' \
- 'appendonly yes' \
- 'appenddirname "redis-state"' \
- 'appendfilename appendonly.aof' \
- && (su user -c 'cd /work && redis-server /work/etc/redis.conf & \
- java -cp '"'/work/classpath/*'"' org.swisspush.gateleen.playground.Server' \
- & sleep 3) \
- && su user -c 'cd /work/gateleen && mvn deploy -PuploadStaticFiles' \
- && pkill -INT java && pkill -INT redis-server \
- && $PKGDEL $PKGS_TO_DEL \
- && $PKGCLEAN \
- && true
-
-USER "${UID}:${GID}"
-
-#CMD ["sleep", "36000"]
-CMD ["sh", "-c", "ip a|grep inet && redis-server /work/etc/redis.conf & java -cp '/work/classpath/*' org.swisspush.gateleen.playground.Server"]
-