single image build data path for azure
This commit is contained in:
parent
03ae7f8e25
commit
4c837f8e86
|
@ -3,15 +3,14 @@
|
||||||
echo ${TARGETBUILD} > /buildtarget.txt
|
echo ${TARGETBUILD} > /buildtarget.txt
|
||||||
if [[ "${TARGETBUILD}" = "aas" ]]; then
|
if [[ "${TARGETBUILD}" = "aas" ]]; then
|
||||||
# Azure AppService uses /home for persisent data & SSH on port 2222
|
# Azure AppService uses /home for persisent data & SSH on port 2222
|
||||||
mkdir -p /home/{search,minio,couch}
|
DATA_DIR=/home
|
||||||
mkdir -p /home/couch/{dbs,views}
|
mkdir -p $DATA_DIR/{search,minio,couchdb}
|
||||||
chown -R couchdb:couchdb /home/couch/
|
mkdir -p $DATA_DIR/couchdb/{dbs,views}
|
||||||
|
chown -R couchdb:couchdb $DATA_DIR/couchdb/
|
||||||
apt update
|
apt update
|
||||||
apt-get install -y openssh-server
|
apt-get install -y openssh-server
|
||||||
sed -i 's#dir=/opt/couchdb/data/search#dir=/home/search#' /opt/clouseau/clouseau.ini
|
|
||||||
sed -i 's#/minio/minio server /minio &#/minio/minio server /home/minio &#' /runner.sh
|
|
||||||
sed -i 's#database_dir = ./data#database_dir = /home/couch/dbs#' /opt/couchdb/etc/default.ini
|
|
||||||
sed -i 's#view_index_dir = ./data#view_index_dir = /home/couch/views#' /opt/couchdb/etc/default.ini
|
|
||||||
sed -i "s/#Port 22/Port 2222/" /etc/ssh/sshd_config
|
sed -i "s/#Port 22/Port 2222/" /etc/ssh/sshd_config
|
||||||
/etc/init.d/ssh restart
|
/etc/init.d/ssh restart
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sed -i 's#DATA_DIR#$DATA_DIR#' /opt/clouseau/clouseau.ini /opt/couchdb/etc/local.ini
|
||||||
|
|
|
@ -20,10 +20,10 @@ RUN node /pinVersions.js && yarn && yarn build && /cleanup.sh
|
||||||
|
|
||||||
FROM couchdb:3.2.1
|
FROM couchdb:3.2.1
|
||||||
# TARGETARCH can be amd64 or arm e.g. docker build --build-arg TARGETARCH=amd64
|
# TARGETARCH can be amd64 or arm e.g. docker build --build-arg TARGETARCH=amd64
|
||||||
ARG TARGETARCH amd64
|
ARG TARGETARCH=amd64
|
||||||
#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)
|
||||||
# e.g. docker build --build-arg TARGETBUILD=aas ....
|
# e.g. docker build --build-arg TARGETBUILD=aas ....
|
||||||
ARG TARGETBUILD single
|
ARG TARGETBUILD=single
|
||||||
ENV TARGETBUILD $TARGETBUILD
|
ENV TARGETBUILD $TARGETBUILD
|
||||||
|
|
||||||
COPY --from=build /app /app
|
COPY --from=build /app /app
|
||||||
|
@ -35,6 +35,7 @@ ENV \
|
||||||
BUDIBASE_ENVIRONMENT=PRODUCTION \
|
BUDIBASE_ENVIRONMENT=PRODUCTION \
|
||||||
CLUSTER_PORT=80 \
|
CLUSTER_PORT=80 \
|
||||||
# CUSTOM_DOMAIN=budi001.custom.com \
|
# CUSTOM_DOMAIN=budi001.custom.com \
|
||||||
|
DATA_DIR=/data \
|
||||||
DEPLOYMENT_ENVIRONMENT=docker \
|
DEPLOYMENT_ENVIRONMENT=docker \
|
||||||
MINIO_URL=http://localhost:9000 \
|
MINIO_URL=http://localhost:9000 \
|
||||||
POSTHOG_TOKEN=phc_fg5I3nDOf6oJVMHSaycEhpPdlgS8rzXG2r6F2IpxCHS \
|
POSTHOG_TOKEN=phc_fg5I3nDOf6oJVMHSaycEhpPdlgS8rzXG2r6F2IpxCHS \
|
||||||
|
@ -114,6 +115,7 @@ RUN chmod +x ./healthcheck.sh
|
||||||
ADD hosting/scripts/build-target-paths.sh .
|
ADD hosting/scripts/build-target-paths.sh .
|
||||||
RUN chmod +x ./build-target-paths.sh
|
RUN chmod +x ./build-target-paths.sh
|
||||||
|
|
||||||
|
# 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
|
||||||
RUN /build-target-paths.sh
|
RUN /build-target-paths.sh
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ name=clouseau@127.0.0.1
|
||||||
cookie=monster
|
cookie=monster
|
||||||
|
|
||||||
; the path where you would like to store the search index files
|
; the path where you would like to store the search index files
|
||||||
dir=/data/search
|
dir=DATA_DIR/search
|
||||||
|
|
||||||
; the number of search indexes that can be open simultaneously
|
; the number of search indexes that can be open simultaneously
|
||||||
max_indexes_open=500
|
max_indexes_open=500
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
; CouchDB Configuration Settings
|
; CouchDB Configuration Settings
|
||||||
|
|
||||||
[couchdb]
|
[couchdb]
|
||||||
database_dir = /data/couch/dbs
|
database_dir = DATA_DIR/couch/dbs
|
||||||
view_index_dir = /data/couch/views
|
view_index_dir = DATA_DIR/couch/views
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
declare -a ENV_VARS=("COUCHDB_USER" "COUCHDB_PASSWORD" "MINIO_ACCESS_KEY" "MINIO_SECRET_KEY" "INTERNAL_API_KEY" "JWT_SECRET" "REDIS_PASSWORD")
|
declare -a ENV_VARS=("COUCHDB_USER" "COUCHDB_PASSWORD" "DATA_DIR" "MINIO_ACCESS_KEY" "MINIO_SECRET_KEY" "INTERNAL_API_KEY" "JWT_SECRET" "REDIS_PASSWORD")
|
||||||
if [ -f "/data/.env" ]; then
|
|
||||||
export $(cat /data/.env | xargs)
|
# Azure App Service customisations
|
||||||
|
if [[ "${TARGETBUILD}" = "aas" ]]; then
|
||||||
|
DATA_DIR=/home
|
||||||
|
/etc/init.d/ssh start
|
||||||
|
else
|
||||||
|
DATA_DIR=${DATA_DIR:-/data}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${DATA_DIR}/.env" ]; then
|
||||||
|
export $(cat ${DATA_DIR}/.env | xargs)
|
||||||
fi
|
fi
|
||||||
# first randomise any unset environment variables
|
# first randomise any unset environment variables
|
||||||
for ENV_VAR in "${ENV_VARS[@]}"
|
for ENV_VAR in "${ENV_VARS[@]}"
|
||||||
|
@ -14,21 +23,26 @@ done
|
||||||
if [[ -z "${COUCH_DB_URL}" ]]; then
|
if [[ -z "${COUCH_DB_URL}" ]]; then
|
||||||
export COUCH_DB_URL=http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984
|
export COUCH_DB_URL=http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984
|
||||||
fi
|
fi
|
||||||
if [ ! -f "/data/.env" ]; then
|
if [ ! -f "${DATA_DIR}/.env" ]; then
|
||||||
touch /data/.env
|
touch ${DATA_DIR}/.env
|
||||||
for ENV_VAR in "${ENV_VARS[@]}"
|
for ENV_VAR in "${ENV_VARS[@]}"
|
||||||
do
|
do
|
||||||
temp=$(eval "echo \$$ENV_VAR")
|
temp=$(eval "echo \$$ENV_VAR")
|
||||||
echo "$ENV_VAR=$temp" >> /data/.env
|
echo "$ENV_VAR=$temp" >> ${DATA_DIR}/.env
|
||||||
done
|
done
|
||||||
|
echo "COUCH_DB_URL=${COUCH_DB_URL}" >> ${DATA_DIR}/.env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export COUCH_DB_URL=http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984
|
||||||
|
|
||||||
# make these directories in runner, incase of mount
|
# make these directories in runner, incase of mount
|
||||||
mkdir -p /data/couch/{dbs,views} /home/couch/{dbs,views}
|
mkdir -p ${DATA_DIR}/couchdb/{dbs,views}
|
||||||
chown -R couchdb:couchdb /data/couch /home/couch
|
mkdir -p ${DATA_DIR}/minio
|
||||||
|
mkdir -p ${DATA_DIR}/search
|
||||||
|
chown -R couchdb:couchdb ${DATA_DIR}/couchdb
|
||||||
redis-server --requirepass $REDIS_PASSWORD &
|
redis-server --requirepass $REDIS_PASSWORD &
|
||||||
/opt/clouseau/bin/clouseau &
|
/opt/clouseau/bin/clouseau &
|
||||||
/minio/minio server /data/minio &
|
/minio/minio server ${DATA_DIR}/minio &
|
||||||
/docker-entrypoint.sh /opt/couchdb/bin/couchdb &
|
/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
|
||||||
|
|
Loading…
Reference in New Issue