Skip to content

Commit 52a0ac7

Browse files
committed
arangodb 3.11.13
1 parent 1c66350 commit 52a0ac7

File tree

3 files changed

+244
-0
lines changed

3 files changed

+244
-0
lines changed

alpine/3.11.13/Dockerfile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM alpine:3.21
2+
MAINTAINER Frank Celler <[email protected]>
3+
4+
ENV ARANGO_VERSION 3.11.13
5+
6+
# see
7+
# https://docs.arangodb.com/3.11/components/arangodb-server/options/#--serverendpoint
8+
# https://docs.arangodb.com/3.11/components/arangodb-server/options/#log
9+
10+
RUN apk add --no-cache gnupg pwgen binutils numactl numactl-tools nodejs yarn && \
11+
yarn global add [email protected] && \
12+
apk del yarn && \
13+
gpg --batch --keyserver keys.openpgp.org --recv-keys 8003EDF6F05459984878D4A6C04AD0FD86FEC04D && \
14+
mkdir /docker-entrypoint-initdb.d && \
15+
cd /tmp && \
16+
arch="$(apk --print-arch)" && \
17+
case "$arch" in \
18+
x86_64) dpkgArch='amd64' ;; \
19+
aarch64) dpkgArch='arm64' ;; \
20+
*) echo >&2 "unsupported: $arch" && exit 1 ;; \
21+
esac && \
22+
ARANGO_URL="https://download.arangodb.com/arangodb311/DEBIAN/$dpkgArch" && \
23+
ARANGO_PACKAGE="arangodb3_${ARANGO_VERSION}-1_${dpkgArch}.deb" && \
24+
ARANGO_PACKAGE_URL="${ARANGO_URL}/${ARANGO_PACKAGE}" && \
25+
ARANGO_SIGNATURE_URL="${ARANGO_PACKAGE_URL}.asc" && \
26+
wget ${ARANGO_SIGNATURE_URL} && \
27+
wget ${ARANGO_PACKAGE_URL} && \
28+
gpg --verify ${ARANGO_PACKAGE}.asc && \
29+
ar x ${ARANGO_PACKAGE} data.tar.gz && \
30+
tar -C / -x -z -f data.tar.gz && \
31+
sed -ri \
32+
-e 's!127\.0\.0\.1!0.0.0.0!g' \
33+
-e 's!^(file\s*=\s*).*!\1 -!' \
34+
-e 's!^\s*uid\s*=.*!!' \
35+
/etc/arangodb3/arangod.conf && \
36+
chgrp -R 0 /var/lib/arangodb3 /var/lib/arangodb3-apps && \
37+
chmod -R 775 /var/lib/arangodb3 /var/lib/arangodb3-apps && \
38+
rm -f /usr/bin/foxx && \
39+
rm -f ${ARANGO_PACKAGE}* data.tar.gz && \
40+
apk del gnupg
41+
# Note that Openshift runs containers by default with a random UID and GID 0.
42+
# We need that the database and apps directory are writable for this config.
43+
44+
ENV GLIBCXX_FORCE_NEW=1
45+
46+
# Adjust TZ by default since tzdata package isn't present (BTS-913)
47+
RUN echo "UTC" > /etc/timezone
48+
49+
# retain the database directory and the Foxx Application directory
50+
VOLUME ["/var/lib/arangodb3", "/var/lib/arangodb3-apps"]
51+
52+
COPY docker-entrypoint.sh /entrypoint.sh
53+
COPY docker-foxx.sh /usr/bin/foxx
54+
55+
ENTRYPOINT ["/entrypoint.sh"]
56+
57+
# standard port
58+
EXPOSE 8529
59+
CMD ["arangod"]

alpine/3.11.13/docker-entrypoint.sh

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -z "$ARANGO_INIT_PORT" ] ; then
5+
ARANGO_INIT_PORT=8999
6+
fi
7+
8+
AUTHENTICATION="true"
9+
10+
# if command starts with an option, prepend arangod
11+
case "$1" in
12+
-*) set -- arangod "$@" ;;
13+
*) ;;
14+
esac
15+
16+
# check for numa
17+
NUMACTL=""
18+
19+
if [ -d /sys/devices/system/node/node1 -a -f /proc/self/numa_maps ]; then
20+
if [ "$NUMA" = "" ]; then
21+
NUMACTL="numactl --interleave=all"
22+
elif [ "$NUMA" != "disable" ]; then
23+
NUMACTL="numactl --interleave=$NUMA"
24+
fi
25+
26+
if [ "$NUMACTL" != "" ]; then
27+
if $NUMACTL echo > /dev/null 2>&1; then
28+
echo "using NUMA $NUMACTL"
29+
else
30+
echo "cannot start with NUMA $NUMACTL: please ensure that docker is running with --cap-add SYS_NICE"
31+
NUMACTL=""
32+
fi
33+
fi
34+
fi
35+
36+
if [ "$1" = 'arangod' ]; then
37+
# /var/lib/arangodb3 and /var/lib/arangodb3-apps must exist and
38+
# be writable by the user under which we run the container.
39+
40+
# Make a copy of the configuration file to patch it, note that this
41+
# must work regardless under which user we run:
42+
cp /etc/arangodb3/arangod.conf /tmp/arangod.conf
43+
44+
ARANGO_STORAGE_ENGINE=rocksdb
45+
if [ ! -z "$ARANGO_ENCRYPTION_KEYFILE" ]; then
46+
echo "Using encrypted database"
47+
sed -i /tmp/arangod.conf -e "s;^.*encryption-keyfile.*;encryption-keyfile=$ARANGO_ENCRYPTION_KEYFILE;"
48+
fi
49+
50+
if [ ! -f /var/lib/arangodb3/SERVER ] && [ "$SKIP_DATABASE_INIT" != "1" ]; then
51+
if [ ! -z "$ARANGO_ROOT_PASSWORD_FILE" ]; then
52+
if [ -f "$ARANGO_ROOT_PASSWORD_FILE" ]; then
53+
ARANGO_ROOT_PASSWORD="$(cat $ARANGO_ROOT_PASSWORD_FILE)"
54+
else
55+
echo "WARNING: password file '$ARANGO_ROOT_PASSWORD_FILE' does not exist"
56+
fi
57+
fi
58+
# Please note that the +x in the following line is for the case
59+
# that ARANGO_ROOT_PASSWORD is set but to an empty value, please
60+
# do not remove!
61+
if [ -z "${ARANGO_ROOT_PASSWORD+x}" ] && [ -z "$ARANGO_NO_AUTH" ] && [ -z "$ARANGO_RANDOM_ROOT_PASSWORD" ]; then
62+
echo >&2 'error: database is uninitialized and password option is not specified '
63+
echo >&2 " You need to specify one of ARANGO_ROOT_PASSWORD, ARANGO_ROOT_PASSWORD_FILE, ARANGO_NO_AUTH and ARANGO_RANDOM_ROOT_PASSWORD"
64+
exit 1
65+
fi
66+
67+
if [ ! -z "$ARANGO_RANDOM_ROOT_PASSWORD" ]; then
68+
ARANGO_ROOT_PASSWORD=$(pwgen -s -1 16)
69+
echo "==========================================="
70+
echo "GENERATED ROOT PASSWORD: $ARANGO_ROOT_PASSWORD"
71+
echo "==========================================="
72+
fi
73+
74+
if [ ! -z "${ARANGO_ROOT_PASSWORD+x}" ]; then
75+
echo "Initializing root user...Hang on..."
76+
ARANGODB_DEFAULT_ROOT_PASSWORD="$ARANGO_ROOT_PASSWORD" /usr/sbin/arango-init-database -c /tmp/arangod.conf --server.rest-server false --log.level error --database.init-database true || true
77+
export ARANGO_ROOT_PASSWORD
78+
79+
if [ ! -z "${ARANGO_ROOT_PASSWORD}" ]; then
80+
ARANGOSH_ARGS=" --server.password ${ARANGO_ROOT_PASSWORD} "
81+
fi
82+
else
83+
ARANGOSH_ARGS=" --server.authentication false"
84+
fi
85+
86+
echo "Initializing database...Hang on..."
87+
88+
$NUMACTL arangod --config /tmp/arangod.conf \
89+
--server.endpoint tcp://127.0.0.1:$ARANGO_INIT_PORT \
90+
--server.authentication false \
91+
--log.file /tmp/init-log \
92+
--log.foreground-tty false &
93+
pid="$!"
94+
95+
counter=0
96+
ARANGO_UP=0
97+
98+
while [ "$ARANGO_UP" = "0" ]; do
99+
if [ $counter -gt 0 ]; then
100+
sleep 1
101+
fi
102+
103+
if [ "$counter" -gt 100 ]; then
104+
echo "ArangoDB didn't start correctly during init"
105+
cat /tmp/init-log
106+
exit 1
107+
fi
108+
109+
let counter=counter+1
110+
ARANGO_UP=1
111+
112+
$NUMACTL arangosh \
113+
--server.endpoint=tcp://127.0.0.1:$ARANGO_INIT_PORT \
114+
--server.authentication false \
115+
--javascript.execute-string "db._version()" \
116+
> /dev/null 2>&1 || ARANGO_UP=0
117+
done
118+
119+
if [ "$(id -u)" = "0" ] ; then
120+
foxx server set default http://127.0.0.1:$ARANGO_INIT_PORT
121+
else
122+
echo Not setting foxx server default because we are not root.
123+
fi
124+
125+
for f in /docker-entrypoint-initdb.d/*; do
126+
case "$f" in
127+
*.sh)
128+
echo "$0: running $f"
129+
. "$f"
130+
;;
131+
*.js)
132+
echo "$0: running $f"
133+
$NUMACTL arangosh ${ARANGOSH_ARGS} \
134+
--server.endpoint=tcp://127.0.0.1:$ARANGO_INIT_PORT \
135+
--javascript.execute "$f"
136+
;;
137+
*/dumps)
138+
echo "$0: restoring databases"
139+
for d in $f/*; do
140+
DBName=$(echo ${d}|sed "s;$f/;;")
141+
echo "restoring $d into ${DBName}";
142+
$NUMACTL arangorestore \
143+
${ARANGOSH_ARGS} \
144+
--server.endpoint=tcp://127.0.0.1:$ARANGO_INIT_PORT \
145+
--create-database true \
146+
--include-system-collections true \
147+
--server.database "$DBName" \
148+
--input-directory "$d"
149+
done
150+
echo
151+
;;
152+
esac
153+
done
154+
155+
if [ "$(id -u)" = "0" ] ; then
156+
foxx server remove default
157+
fi
158+
159+
if ! kill -s TERM "$pid" || ! wait "$pid"; then
160+
echo >&2 'ArangoDB Init failed.'
161+
exit 1
162+
fi
163+
164+
echo "Database initialized...Starting System..."
165+
fi
166+
167+
# if we really want to start arangod and not bash or any other thing
168+
# prepend --authentication as the FIRST argument
169+
# (so it is overridable via command line as well)
170+
shift
171+
172+
if [ ! -z "$ARANGO_NO_AUTH" ]; then
173+
AUTHENTICATION="false"
174+
fi
175+
176+
set -- arangod "$@" --server.authentication="$AUTHENTICATION" --config /tmp/arangod.conf
177+
else
178+
NUMACTL=""
179+
fi
180+
181+
exec $NUMACTL "$@"

alpine/3.11.13/docker-foxx.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
test -d /tmp/foxx || mkdir -m 700 /tmp/foxx
3+
export HOME=/tmp/foxx
4+
exec /usr/local/share/.config/yarn/global/node_modules/.bin/foxx "$@"

0 commit comments

Comments
 (0)