Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions alpine/3.5.5.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.10
FROM alpine:3.11
MAINTAINER Frank Celler <info@arangodb.com>

ENV ARANGO_VERSION 3.5.5.1
Expand All @@ -11,9 +11,9 @@ ENV ARANGO_SIGNATURE_URL ${ARANGO_PACKAGE_URL}.asc
# https://www.arangodb.com/docs/3.5/programs-arangod-server.html#managing-endpoints
# https://www.arangodb.com/docs/3.5/programs-arangod-log.html

RUN apk add --no-cache gnupg pwgen nodejs npm binutils numactl numactl-tools && \
npm install -g foxx-cli@1.3.0 && \
rm -rf /root/.npm && \
RUN apk add --no-cache gnupg pwgen binutils numactl numactl-tools nodejs yarn && \
yarn global add foxx-cli && \
apk del yarn && \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CD8CB0F1E0AD5B52E93F41E7EA93F5E56E751E9B && \
mkdir /docker-entrypoint-initdb.d && \
cd /tmp && \
Expand Down
2 changes: 1 addition & 1 deletion alpine/3.5.5.1/docker-foxx.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
test -d /tmp/foxx || mkdir -m 700 /tmp/foxx
export HOME=/tmp/foxx
exec /usr/lib/node_modules/foxx-cli/bin/foxx "$@"
exec /usr/local/share/.config/yarn/global/node_modules/.bin/foxx "$@"
9 changes: 4 additions & 5 deletions alpine/3.6.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.10
FROM alpine:3.11
MAINTAINER Frank Celler <info@arangodb.com>

ENV ARANGO_VERSION 3.6.5
Expand All @@ -11,10 +11,9 @@ ENV ARANGO_SIGNATURE_URL ${ARANGO_PACKAGE_URL}.asc
# https://www.arangodb.com/docs/3.6/programs-arangod-server.html#managing-endpoints
# https://www.arangodb.com/docs/3.6/programs-arangod-log.html

RUN apk add --no-cache gnupg pwgen binutils numactl numactl-tools && \
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.11/main/ nodejs npm && \
npm install -g foxx-cli && \
rm -rf /root/.npm && apk del npm && \
RUN apk add --no-cache gnupg pwgen binutils numactl numactl-tools nodejs yarn && \
yarn global add foxx-cli && \
apk del yarn && \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CD8CB0F1E0AD5B52E93F41E7EA93F5E56E751E9B && \
mkdir /docker-entrypoint-initdb.d && \
cd /tmp && \
Expand Down
2 changes: 1 addition & 1 deletion alpine/3.6.5/docker-foxx.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
test -d /tmp/foxx || mkdir -m 700 /tmp/foxx
export HOME=/tmp/foxx
exec /usr/lib/node_modules/foxx-cli/bin/foxx "$@"
exec /usr/local/share/.config/yarn/global/node_modules/.bin/foxx "$@"
48 changes: 48 additions & 0 deletions alpine/3.7.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM alpine:3.11
MAINTAINER Frank Celler <info@arangodb.com>

ENV ARANGO_VERSION 3.7.1
ENV ARANGO_URL https://download.arangodb.com/arangodb37/DEBIAN/amd64
ENV ARANGO_PACKAGE arangodb3_${ARANGO_VERSION}-1_amd64.deb
ENV ARANGO_PACKAGE_URL ${ARANGO_URL}/${ARANGO_PACKAGE}
ENV ARANGO_SIGNATURE_URL ${ARANGO_PACKAGE_URL}.asc

# see
# https://www.arangodb.com/docs/3.7/programs-arangod-server.html#managing-endpoints
# https://www.arangodb.com/docs/3.7/programs-arangod-log.html

RUN apk add --no-cache gnupg pwgen binutils numactl numactl-tools nodejs yarn && \
yarn global add foxx-cli && \
apk del yarn && \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys CD8CB0F1E0AD5B52E93F41E7EA93F5E56E751E9B && \
mkdir /docker-entrypoint-initdb.d && \
cd /tmp && \
wget ${ARANGO_SIGNATURE_URL} && \
wget ${ARANGO_PACKAGE_URL} && \
gpg --verify ${ARANGO_PACKAGE}.asc && \
ar x ${ARANGO_PACKAGE} data.tar.gz && \
tar -C / -x -z -f data.tar.gz && \
sed -ri \
-e 's!127\.0\.0\.1!0.0.0.0!g' \
-e 's!^(file\s*=\s*).*!\1 -!' \
-e 's!^\s*uid\s*=.*!!' \
/etc/arangodb3/arangod.conf && \
echo chgrp -R 0 /var/lib/arangodb3 /var/lib/arangodb3-apps && \
echo chmod -R 775 /var/lib/arangodb3 /var/lib/arangodb3-apps && \
rm -f /usr/bin/foxx && \
rm -f ${ARANGO_PACKAGE}* data.tar.gz && \
apk del gnupg
# Note that Openshift runs containers by default with a random UID and GID 0.
# We need that the database and apps directory are writable for this config.

# retain the database directory and the Foxx Application directory
VOLUME ["/var/lib/arangodb3", "/var/lib/arangodb3-apps"]

COPY docker-entrypoint.sh /entrypoint.sh
COPY docker-foxx.sh /usr/bin/foxx

ENTRYPOINT ["/entrypoint.sh"]

# standard port
EXPOSE 8529
CMD ["arangod"]
191 changes: 191 additions & 0 deletions alpine/3.7.1/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
#!/bin/sh
set -e

if [ -z "$ARANGO_INIT_PORT" ] ; then
ARANGO_INIT_PORT=8999
fi

AUTHENTICATION="true"
export GLIBCXX_FORCE_NEW=1

# if command starts with an option, prepend arangod
case "$1" in
-*) set -- arangod "$@" ;;
*) ;;
esac

# check for numa
NUMACTL=""

if [ -d /sys/devices/system/node/node1 -a -f /proc/self/numa_maps ]; then
if [ "$NUMA" = "" ]; then
NUMACTL="numactl --interleave=all"
elif [ "$NUMA" != "disable" ]; then
NUMACTL="numactl --interleave=$NUMA"
fi

if [ "$NUMACTL" != "" ]; then
if $NUMACTL echo > /dev/null 2>&1; then
echo "using NUMA $NUMACTL"
else
echo "cannot start with NUMA $NUMACTL: please ensure that docker is running with --cap-add SYS_NICE"
NUMACTL=""
fi
fi
fi

if [ "$1" = 'arangod' ]; then
# /var/lib/arangodb3 and /var/lib/arangodb3-apps must exist and
# be writable by the user under which we run the container.

# Make a copy of the configuration file to patch it, note that this
# must work regardless under which user we run:
cp /etc/arangodb3/arangod.conf /tmp/arangod.conf

if [ ! -z "$ARANGO_ENCRYPTION_KEYFILE" ]; then
echo "Using encrypted database"
sed -i /tmp/arangod.conf -e "s;^.*encryption-keyfile.*;encryption-keyfile=$ARANGO_ENCRYPTION_KEYFILE;"
ARANGO_STORAGE_ENGINE=rocksdb
fi

if [ "$ARANGO_STORAGE_ENGINE" == "rocksdb" ]; then
echo "choosing RocksDB storage engine"
sed -i /tmp/arangod.conf -e "s;storage-engine = auto;storage-engine = rocksdb;"
elif [ "$ARANGO_STORAGE_ENGINE" == "mmfiles" ]; then
echo "choosing MMFiles storage engine"
sed -i /tmp/arangod.conf -e "s;storage-engine = auto;storage-engine = mmfiles;"
else
echo "automatically choosing storage engine"
fi
if [ ! -f /var/lib/arangodb3/SERVER ] && [ "$SKIP_DATABASE_INIT" != "1" ]; then
if [ ! -z "$ARANGO_ROOT_PASSWORD_FILE" ]; then
if [ -f "$ARANGO_ROOT_PASSWORD_FILE" ]; then
ARANGO_ROOT_PASSWORD="$(cat $ARANGO_ROOT_PASSWORD_FILE)"
else
echo "WARNING: password file '$ARANGO_ROOT_PASSWORD_FILE' does not exist"
fi
fi
# Please note that the +x in the following line is for the case
# that ARANGO_ROOT_PASSWORD is set but to an empty value, please
# do not remove!
if [ -z "${ARANGO_ROOT_PASSWORD+x}" ] && [ -z "$ARANGO_NO_AUTH" ] && [ -z "$ARANGO_RANDOM_ROOT_PASSWORD" ]; then
echo >&2 'error: database is uninitialized and password option is not specified '
echo >&2 " You need to specify one of ARANGO_ROOT_PASSWORD, ARANGO_ROOT_PASSWORD_FILE, ARANGO_NO_AUTH and ARANGO_RANDOM_ROOT_PASSWORD"
exit 1
fi

if [ ! -z "$ARANGO_RANDOM_ROOT_PASSWORD" ]; then
ARANGO_ROOT_PASSWORD=$(pwgen -s -1 16)
echo "==========================================="
echo "GENERATED ROOT PASSWORD: $ARANGO_ROOT_PASSWORD"
echo "==========================================="
fi

if [ ! -z "${ARANGO_ROOT_PASSWORD+x}" ]; then
echo "Initializing root user...Hang on..."
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
export ARANGO_ROOT_PASSWORD

if [ ! -z "${ARANGO_ROOT_PASSWORD}" ]; then
ARANGOSH_ARGS=" --server.password ${ARANGO_ROOT_PASSWORD} "
fi
else
ARANGOSH_ARGS=" --server.authentication false"
fi

echo "Initializing database...Hang on..."

$NUMACTL arangod --config /tmp/arangod.conf \
--server.endpoint tcp://127.0.0.1:$ARANGO_INIT_PORT \
--server.authentication false \
--log.file /tmp/init-log \
--log.foreground-tty false &
pid="$!"

counter=0
ARANGO_UP=0

while [ "$ARANGO_UP" = "0" ]; do
if [ $counter -gt 0 ]; then
sleep 1
fi

if [ "$counter" -gt 100 ]; then
echo "ArangoDB didn't start correctly during init"
cat /tmp/init-log
exit 1
fi

let counter=counter+1
ARANGO_UP=1

$NUMACTL arangosh \
--server.endpoint=tcp://127.0.0.1:$ARANGO_INIT_PORT \
--server.authentication false \
--javascript.execute-string "db._version()" \
> /dev/null 2>&1 || ARANGO_UP=0
done

if [ "$(id -u)" = "0" ] ; then
foxx server set default http://127.0.0.1:$ARANGO_INIT_PORT
else
echo Not setting foxx server default because we are not root.
fi

for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sh)
echo "$0: running $f"
. "$f"
;;
*.js)
echo "$0: running $f"
$NUMACTL arangosh ${ARANGOSH_ARGS} \
--server.endpoint=tcp://127.0.0.1:$ARANGO_INIT_PORT \
--javascript.execute "$f"
;;
*/dumps)
echo "$0: restoring databases"
for d in $f/*; do
DBName=$(echo ${d}|sed "s;$f/;;")
echo "restoring $d into ${DBName}";
$NUMACTL arangorestore \
${ARANGOSH_ARGS} \
--server.endpoint=tcp://127.0.0.1:$ARANGO_INIT_PORT \
--create-database true \
--include-system-collections true \
--server.database "$DBName" \
--input-directory "$d"
done
echo
;;
esac
done

if [ "$(id -u)" = "0" ] ; then
foxx server remove default
fi

if ! kill -s TERM "$pid" || ! wait "$pid"; then
echo >&2 'ArangoDB Init failed.'
exit 1
fi

echo "Database initialized...Starting System..."
fi

# if we really want to start arangod and not bash or any other thing
# prepend --authentication as the FIRST argument
# (so it is overridable via command line as well)
shift

if [ ! -z "$ARANGO_NO_AUTH" ]; then
AUTHENTICATION="false"
fi

set -- arangod "$@" --server.authentication="$AUTHENTICATION" --config /tmp/arangod.conf
else
NUMACTL=""
fi

exec $NUMACTL "$@"
4 changes: 4 additions & 0 deletions alpine/3.7.1/docker-foxx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
test -d /tmp/foxx || mkdir -m 700 /tmp/foxx
export HOME=/tmp/foxx
exec /usr/local/share/.config/yarn/global/node_modules/.bin/foxx "$@"