Updating single image, break out couchdb config into its own image.
This commit is contained in:
parent
5f1019d9fd
commit
9b144f61f7
|
@ -4,9 +4,10 @@ ENV COUCHDB_USER admin
|
||||||
ENV COUCHDB_PASSWORD admin
|
ENV COUCHDB_PASSWORD admin
|
||||||
EXPOSE 5984
|
EXPOSE 5984
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y software-properties-common wget unzip curl && \
|
RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common wget unzip curl && \
|
||||||
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \
|
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \
|
||||||
apt-get update && apt-get install -y openjdk-8-jdk
|
apt-get update && apt-get install -y --no-install-recommends openjdk-8-jre && \
|
||||||
|
rm -rf /var/lib/apt/lists/
|
||||||
|
|
||||||
# setup clouseau
|
# setup clouseau
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
@ -19,13 +20,13 @@ WORKDIR /opt/clouseau
|
||||||
RUN mkdir ./bin
|
RUN mkdir ./bin
|
||||||
ADD clouseau/clouseau ./bin/
|
ADD clouseau/clouseau ./bin/
|
||||||
ADD clouseau/log4j.properties clouseau/clouseau.ini ./
|
ADD clouseau/log4j.properties clouseau/clouseau.ini ./
|
||||||
RUN chmod +x ./bin/clouseau
|
|
||||||
|
|
||||||
# setup CouchDB
|
# setup CouchDB
|
||||||
WORKDIR /opt/couchdb
|
WORKDIR /opt/couchdb
|
||||||
ADD couch/vm.args couch/local.ini ./etc/
|
ADD couch/vm.args couch/local.ini ./etc/
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
ADD build-target-paths.sh .
|
||||||
ADD runner.sh ./bbcouch-runner.sh
|
ADD runner.sh ./bbcouch-runner.sh
|
||||||
RUN chmod +x ./bbcouch-runner.sh
|
RUN chmod +x ./bbcouch-runner.sh /opt/clouseau/bin/clouseau ./build-target-paths.sh
|
||||||
ENTRYPOINT ["./bbcouch-runner.sh"]
|
CMD ["./bbcouch-runner.sh"]
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo ${TARGETBUILD} > /buildtarget.txt
|
||||||
|
if [[ "${TARGETBUILD}" = "aas" ]]; then
|
||||||
|
# Azure AppService uses /home for persisent data & SSH on port 2222
|
||||||
|
DATA_DIR=/home
|
||||||
|
WEBSITES_ENABLE_APP_SERVICE_STORAGE=true
|
||||||
|
mkdir -p $DATA_DIR/{search,minio,couch}
|
||||||
|
mkdir -p $DATA_DIR/couch/{dbs,views}
|
||||||
|
chown -R couchdb:couchdb $DATA_DIR/couch/
|
||||||
|
apt update
|
||||||
|
apt-get install -y openssh-server
|
||||||
|
echo "root:Docker!" | chpasswd
|
||||||
|
mkdir -p /tmp
|
||||||
|
chmod +x /tmp/ssh_setup.sh \
|
||||||
|
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null)
|
||||||
|
cp /etc/sshd_config /etc/ssh/sshd_config
|
||||||
|
/etc/init.d/ssh restart
|
||||||
|
sed -i "s#DATA_DIR#/home#g" /opt/clouseau/clouseau.ini
|
||||||
|
sed -i "s#DATA_DIR#/home#g" /opt/couchdb/etc/local.ini
|
||||||
|
else
|
||||||
|
sed -i "s#DATA_DIR#/data#g" /opt/clouseau/clouseau.ini
|
||||||
|
sed -i "s#DATA_DIR#/data#g" /opt/couchdb/etc/local.ini
|
||||||
|
fi
|
|
@ -1,5 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
DATA_DIR=${DATA_DIR:-/data}
|
||||||
|
mkdir -p ${DATA_DIR}
|
||||||
|
mkdir -p ${DATA_DIR}/couch/{dbs,views}
|
||||||
|
mkdir -p ${DATA_DIR}/search
|
||||||
|
chown -R couchdb:couchdb ${DATA_DIR}/couch
|
||||||
|
/build-target-paths.sh
|
||||||
/docker-entrypoint.sh /opt/couchdb/bin/couchdb &
|
/docker-entrypoint.sh /opt/couchdb/bin/couchdb &
|
||||||
sleep 10
|
sleep 10
|
||||||
curl -X PUT http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@localhost:5984/_users
|
curl -X PUT http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@localhost:5984/_users
|
|
@ -18,7 +18,7 @@ WORKDIR /worker
|
||||||
ADD packages/worker .
|
ADD packages/worker .
|
||||||
RUN node /pinVersions.js && yarn && yarn build && /cleanup.sh
|
RUN node /pinVersions.js && yarn && yarn build && /cleanup.sh
|
||||||
|
|
||||||
FROM couchdb:3.2.1
|
FROM budibase-couchdb
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ENV TARGETARCH $TARGETARCH
|
ENV TARGETARCH $TARGETARCH
|
||||||
#TARGETBUILD can be set to single (for single docker image) or aas (for azure app service)
|
#TARGETBUILD can be set to single (for single docker image) or aas (for azure app service)
|
||||||
|
@ -29,23 +29,9 @@ ENV TARGETBUILD $TARGETBUILD
|
||||||
COPY --from=build /app /app
|
COPY --from=build /app /app
|
||||||
COPY --from=build /worker /worker
|
COPY --from=build /worker /worker
|
||||||
|
|
||||||
# ENV CUSTOM_DOMAIN=budi001.custom.com \
|
|
||||||
# See runner.sh for Env Vars
|
|
||||||
# These secret env variables are generated by the runner at startup
|
|
||||||
# their values can be overriden by the user, they will be written
|
|
||||||
# to the .env file in the /data directory for use later on
|
|
||||||
# REDIS_PASSWORD=budibase \
|
|
||||||
# COUCHDB_PASSWORD=budibase \
|
|
||||||
# COUCHDB_USER=budibase \
|
|
||||||
# COUCH_DB_URL=http://budibase:budibase@localhost:5984 \
|
|
||||||
# INTERNAL_API_KEY=budibase \
|
|
||||||
# JWT_SECRET=testsecret \
|
|
||||||
# MINIO_ACCESS_KEY=budibase \
|
|
||||||
# MINIO_SECRET_KEY=budibase \
|
|
||||||
|
|
||||||
# install base dependencies
|
# install base dependencies
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y software-properties-common wget nginx uuid-runtime && \
|
apt-get install -y --no-install-recommends software-properties-common nginx uuid-runtime redis-server && \
|
||||||
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \
|
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
|
@ -53,7 +39,7 @@ RUN apt-get update && \
|
||||||
WORKDIR /nodejs
|
WORKDIR /nodejs
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh && \
|
RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh && \
|
||||||
bash /tmp/nodesource_setup.sh && \
|
bash /tmp/nodesource_setup.sh && \
|
||||||
apt-get install -y libaio1 nodejs nginx openjdk-8-jdk redis-server unzip && \
|
apt-get install -y --no-install-recommends libaio1 nodejs && \
|
||||||
npm install --global yarn pm2
|
npm install --global yarn pm2
|
||||||
|
|
||||||
# setup nginx
|
# setup nginx
|
||||||
|
@ -68,23 +54,6 @@ RUN mkdir -p scripts/integrations/oracle
|
||||||
ADD packages/server/scripts/integrations/oracle scripts/integrations/oracle
|
ADD packages/server/scripts/integrations/oracle scripts/integrations/oracle
|
||||||
RUN /bin/bash -e ./scripts/integrations/oracle/instantclient/linux/install.sh
|
RUN /bin/bash -e ./scripts/integrations/oracle/instantclient/linux/install.sh
|
||||||
|
|
||||||
# setup clouseau
|
|
||||||
WORKDIR /
|
|
||||||
RUN wget https://github.com/cloudant-labs/clouseau/releases/download/2.21.0/clouseau-2.21.0-dist.zip && \
|
|
||||||
unzip clouseau-2.21.0-dist.zip && \
|
|
||||||
mv clouseau-2.21.0 /opt/clouseau && \
|
|
||||||
rm clouseau-2.21.0-dist.zip
|
|
||||||
|
|
||||||
WORKDIR /opt/clouseau
|
|
||||||
RUN mkdir ./bin
|
|
||||||
ADD hosting/single/clouseau/clouseau ./bin/
|
|
||||||
ADD hosting/single/clouseau/log4j.properties hosting/single/clouseau/clouseau.ini ./
|
|
||||||
RUN chmod +x ./bin/clouseau
|
|
||||||
|
|
||||||
# setup CouchDB
|
|
||||||
WORKDIR /opt/couchdb
|
|
||||||
ADD hosting/single/couch/vm.args hosting/single/couch/local.ini ./etc/
|
|
||||||
|
|
||||||
# setup minio
|
# setup minio
|
||||||
WORKDIR /minio
|
WORKDIR /minio
|
||||||
ADD scripts/install-minio.sh ./install.sh
|
ADD scripts/install-minio.sh ./install.sh
|
||||||
|
@ -97,9 +66,6 @@ RUN chmod +x ./runner.sh
|
||||||
ADD hosting/single/healthcheck.sh .
|
ADD hosting/single/healthcheck.sh .
|
||||||
RUN chmod +x ./healthcheck.sh
|
RUN chmod +x ./healthcheck.sh
|
||||||
|
|
||||||
ADD hosting/scripts/build-target-paths.sh .
|
|
||||||
RUN chmod +x ./build-target-paths.sh
|
|
||||||
|
|
||||||
# Script below sets the path for storing data based on $DATA_DIR
|
# Script below sets the path for storing data based on $DATA_DIR
|
||||||
# For Azure App Service install SSH & point data locations to /home
|
# For Azure App Service install SSH & point data locations to /home
|
||||||
ADD hosting/single/ssh/sshd_config /etc/
|
ADD hosting/single/ssh/sshd_config /etc/
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
/usr/bin/java -server \
|
|
||||||
-Xmx2G \
|
|
||||||
-Dsun.net.inetaddr.ttl=30 \
|
|
||||||
-Dsun.net.inetaddr.negative.ttl=30 \
|
|
||||||
-Dlog4j.configuration=file:/opt/clouseau/log4j.properties \
|
|
||||||
-XX:OnOutOfMemoryError="kill -9 %p" \
|
|
||||||
-XX:+UseConcMarkSweepGC \
|
|
||||||
-XX:+CMSParallelRemarkEnabled \
|
|
||||||
-classpath '/opt/clouseau/*' \
|
|
||||||
com.cloudant.clouseau.Main \
|
|
||||||
/opt/clouseau/clouseau.ini
|
|
|
@ -1,13 +0,0 @@
|
||||||
[clouseau]
|
|
||||||
|
|
||||||
; the name of the Erlang node created by the service, leave this unchanged
|
|
||||||
name=clouseau@127.0.0.1
|
|
||||||
|
|
||||||
; set this to the same distributed Erlang cookie used by the CouchDB nodes
|
|
||||||
cookie=monster
|
|
||||||
|
|
||||||
; the path where you would like to store the search index files
|
|
||||||
dir=DATA_DIR/search
|
|
||||||
|
|
||||||
; the number of search indexes that can be open simultaneously
|
|
||||||
max_indexes_open=500
|
|
|
@ -1,4 +0,0 @@
|
||||||
log4j.rootLogger=debug, CONSOLE
|
|
||||||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %c [%p] %m%n
|
|
|
@ -1,5 +0,0 @@
|
||||||
; CouchDB Configuration Settings
|
|
||||||
|
|
||||||
[couchdb]
|
|
||||||
database_dir = DATA_DIR/couch/dbs
|
|
||||||
view_index_dir = DATA_DIR/couch/views
|
|
|
@ -1,32 +0,0 @@
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
# use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
# the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations under
|
|
||||||
# the License.
|
|
||||||
|
|
||||||
# erlang cookie for clouseau security
|
|
||||||
-name couchdb@127.0.0.1
|
|
||||||
-setcookie monster
|
|
||||||
|
|
||||||
# Ensure that the Erlang VM listens on a known port
|
|
||||||
-kernel inet_dist_listen_min 9100
|
|
||||||
-kernel inet_dist_listen_max 9100
|
|
||||||
|
|
||||||
# Tell kernel and SASL not to log anything
|
|
||||||
-kernel error_logger silent
|
|
||||||
-sasl sasl_error_logger false
|
|
||||||
|
|
||||||
# Use kernel poll functionality if supported by emulator
|
|
||||||
+K true
|
|
||||||
|
|
||||||
# Start a pool of asynchronous IO threads
|
|
||||||
+A 16
|
|
||||||
|
|
||||||
# Comment this line out to enable the interactive Erlang shell on startup
|
|
||||||
+Bd -noinput
|
|
|
@ -72,14 +72,11 @@ for LINE in $(cat ${DATA_DIR}/.env); do export $LINE; done
|
||||||
ln -s ${DATA_DIR}/.env /app/.env
|
ln -s ${DATA_DIR}/.env /app/.env
|
||||||
ln -s ${DATA_DIR}/.env /worker/.env
|
ln -s ${DATA_DIR}/.env /worker/.env
|
||||||
# make these directories in runner, incase of mount
|
# make these directories in runner, incase of mount
|
||||||
mkdir -p ${DATA_DIR}/couch/{dbs,views}
|
|
||||||
mkdir -p ${DATA_DIR}/minio
|
mkdir -p ${DATA_DIR}/minio
|
||||||
mkdir -p ${DATA_DIR}/search
|
|
||||||
chown -R couchdb:couchdb ${DATA_DIR}/couch
|
chown -R couchdb:couchdb ${DATA_DIR}/couch
|
||||||
redis-server --requirepass $REDIS_PASSWORD > /dev/stdout 2>&1 &
|
redis-server --requirepass $REDIS_PASSWORD > /dev/stdout 2>&1 &
|
||||||
/opt/clouseau/bin/clouseau > /dev/stdout 2>&1 &
|
/bbcouch-runner.sh &
|
||||||
/minio/minio server ${DATA_DIR}/minio > /dev/stdout 2>&1 &
|
/minio/minio server ${DATA_DIR}/minio > /dev/stdout 2>&1 &
|
||||||
/docker-entrypoint.sh /opt/couchdb/bin/couchdb &
|
|
||||||
/etc/init.d/nginx restart
|
/etc/init.d/nginx restart
|
||||||
if [[ ! -z "${CUSTOM_DOMAIN}" ]]; then
|
if [[ ! -z "${CUSTOM_DOMAIN}" ]]; then
|
||||||
# Add monthly cron job to renew certbot certificate
|
# Add monthly cron job to renew certbot certificate
|
||||||
|
@ -90,15 +87,14 @@ if [[ ! -z "${CUSTOM_DOMAIN}" ]]; then
|
||||||
/etc/init.d/nginx restart
|
/etc/init.d/nginx restart
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# wait for backend services to start
|
||||||
|
sleep 10
|
||||||
|
|
||||||
pushd app
|
pushd app
|
||||||
pm2 start -l /dev/stdout --name app "yarn run:docker"
|
pm2 start -l /dev/stdout --name app "yarn run:docker"
|
||||||
popd
|
popd
|
||||||
pushd worker
|
pushd worker
|
||||||
pm2 start -l /dev/stdout --name worker "yarn run:docker"
|
pm2 start -l /dev/stdout --name worker "yarn run:docker"
|
||||||
popd
|
popd
|
||||||
sleep 10
|
|
||||||
echo "curl to couchdb endpoints"
|
|
||||||
curl -X PUT ${COUCH_DB_URL}/_users
|
|
||||||
curl -X PUT ${COUCH_DB_URL}/_replicator
|
|
||||||
echo "end of runner.sh, sleeping ..."
|
echo "end of runner.sh, sleeping ..."
|
||||||
sleep infinity
|
sleep infinity
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
"build:docker:single:multiarch": "docker buildx build --platform linux/arm64,linux/amd64 -f hosting/single/Dockerfile -t budibase:latest .",
|
"build:docker:single:multiarch": "docker buildx build --platform linux/arm64,linux/amd64 -f hosting/single/Dockerfile -t budibase:latest .",
|
||||||
"build:docker:single:image": "docker build -f hosting/single/Dockerfile -t budibase:latest .",
|
"build:docker:single:image": "docker build -f hosting/single/Dockerfile -t budibase:latest .",
|
||||||
"build:docker:single": "npm run build:docker:pre && npm run build:docker:single:image",
|
"build:docker:single": "npm run build:docker:pre && npm run build:docker:single:image",
|
||||||
|
"build:docker:couch": "docker build -f hosting/couchdb/Dockerfile -t budibase-couchdb:latest ./hosting/couchdb",
|
||||||
"build:docs": "lerna run build:docs",
|
"build:docs": "lerna run build:docs",
|
||||||
"release:helm": "node scripts/releaseHelmChart",
|
"release:helm": "node scripts/releaseHelmChart",
|
||||||
"env:multi:enable": "lerna run env:multi:enable",
|
"env:multi:enable": "lerna run env:multi:enable",
|
||||||
|
|
Loading…
Reference in New Issue