blob: 2763daec9d47e314302b65c8ab1e42cf0024d9b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
Step-by-step shell snippets how to build gateleen
=================================================
## Alpine
&& PKGS_TO_ADD="curl maven nodejs npm redis openjdk11-jre-headless" \
&& SUDO="${HOME:?}/.local/bin/mysudo" \
&& PKGINIT=true \
&& PKGADD="$SUDO apk add" \
&& PKGCLEAN=true \
&& mkdir -p "${HOME:?}/.local/bin" \
&& printf '%s\n' '#!/bin/sh' 'printf "Sudo "' 'su root -c "$(echo "$@")"' > "${HOME:?}/.local/bin/mysudo" \
&& chmod u+x "${HOME:?}/.local/bin/mysudo" \
## Generic
&& GATELEEN_GIT_TAG="v1.3.28" \
&& WORKDIR="/${HOME:?}/work" \
&& CACHE_DIR="/var/tmp" \
## Setup Dependencies & get sources
&& ${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" \
## Corporation specific setup
- Configure proxy if needed.
- Configure "/home/user/.npmrc" if needed.
- Configure "/home/user/.m2/settings.xml" if needed.
## Make
&& 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 -INT java || sleep 3 && pkill -TERM java || sleep 3 && pkill -9 java) \
&& pkill -INT redis-server \
&& $PKGDEL $PKGS_TO_DEL \
&& $PKGCLEAN \
&& sleep 3 \
&& (cd "${WORKDIR:?}/gateleen" && mvn clean) \
&& printf '\n DONE\n\n' \
### Run
&& ip a | grep inet \
&& (true \
&& (cd "${WORKDIR:?}/redis-state" && redis-server "${WORKDIR:?}/etc/redis.conf") \
& true \
&& cd ~ \
&& java -cp "${WORKDIR:?}/classpath/"'*' org.swisspush.gateleen.playground.Server \
) \
|