Putting together the basics of the compose system, this is now functional, along with some handy scripts to make it work. This requires minimum docker 1.25.0 to run due to the use of --env-file.
This commit is contained in:
parent
6718287a65
commit
f2b19aab3f
|
@ -0,0 +1,67 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
app-service:
|
||||
build: ./server
|
||||
volumes:
|
||||
- ./server:/app
|
||||
ports:
|
||||
- "4001:4001"
|
||||
environment:
|
||||
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
|
||||
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
|
||||
SELF_HOSTED: ${SELF_HOSTED}
|
||||
COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984
|
||||
BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT}
|
||||
depends_on:
|
||||
- nginx-service
|
||||
- minio-service
|
||||
- couch-init
|
||||
|
||||
minio-service:
|
||||
image: minio/minio:RELEASE.2020-12-10T01-54-29Z
|
||||
volumes:
|
||||
- data1:/data
|
||||
expose:
|
||||
- "9000"
|
||||
environment:
|
||||
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
|
||||
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
|
||||
command: server /data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
nginx-service:
|
||||
image: nginx:1.19.2-alpine
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
ports:
|
||||
- "9000:9000"
|
||||
depends_on:
|
||||
- minio-service
|
||||
|
||||
couchdb-service:
|
||||
image: apache/couchdb:3.0
|
||||
environment:
|
||||
- COUCHDB_PASSWORD=${COUCH_DB_PASSWORD}
|
||||
- COUCHDB_USER=${COUCH_DB_USER}
|
||||
ports:
|
||||
- "5984:5984"
|
||||
- "4369:4369"
|
||||
- "9100:9100"
|
||||
volumes:
|
||||
- couchdb_data:/couchdb
|
||||
|
||||
couch-init:
|
||||
image: curlimages/curl
|
||||
depends_on:
|
||||
- couchdb-service
|
||||
command: ["sh","-c","sleep 10 && curl -u ${COUCH_DB_USER}:${COUCH_DB_PASSWORD} -X PUT couchdb-service:5984/_users && curl -u ${COUCH_DB_USER}:${COUCH_DB_PASSWORD} -X PUT couchdb-service:5984/_replicator; fg ; "]
|
||||
|
||||
volumes:
|
||||
couchdb_data:
|
||||
driver: local
|
||||
data1:
|
|
@ -1,6 +1,6 @@
|
|||
minio_access_key=budibase
|
||||
minio_secret_key=budibase
|
||||
minio_port=9000
|
||||
# specify the following below settings if switching credentials
|
||||
#minio_secret_key_old=minioadmin
|
||||
#minio_access_key_old=minioadmin
|
||||
SELF_HOSTED=1
|
||||
MINIO_ACCESS_KEY=budibase
|
||||
MINIO_SECRET_KEY=budibase
|
||||
COUCH_DB_PASSWORD=budibase
|
||||
COUCH_DB_USER=budibase
|
||||
BUDIBASE_ENVIRONMENT=PRODUCTION
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
|
@ -0,0 +1,65 @@
|
|||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
# include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
upstream minio {
|
||||
server minio:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9000;
|
||||
listen [::]:9000;
|
||||
server_name localhost;
|
||||
|
||||
# To allow special characters in headers
|
||||
ignore_invalid_headers off;
|
||||
# Allow any size file to be uploaded.
|
||||
# Set to a value such as 1000m; to restrict file size to a specific value
|
||||
client_max_body_size 0;
|
||||
# To disable buffering
|
||||
proxy_buffering off;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_connect_timeout 300;
|
||||
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
chunked_transfer_encoding off;
|
||||
|
||||
proxy_pass http://minio;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
../packages/server/
|
|
@ -1,20 +1,2 @@
|
|||
#!/bin/bash
|
||||
|
||||
function dockerInstalled {
|
||||
echo "Checking docker installation..."
|
||||
if [ ! -x "$(command -v docker)" ]; then
|
||||
echo "Please install docker to continue"
|
||||
exit -1
|
||||
fi
|
||||
}
|
||||
|
||||
dockerInstalled
|
||||
|
||||
source "${BASH_SOURCE%/*}/hosting.properties"
|
||||
|
||||
opts="-e MINIO_ACCESS_KEY=$minio_access_key -e MINIO_SECRET_KEY=$minio_secret_key"
|
||||
if [ -n "$minio_secret_key_old" ] && [ -n "$minio_access_key_old" ]; then
|
||||
opts="$opts -e MINIO_SECRET_KEY_OLD=$minio_secret_key_old -e MINIO_ACCESS_KEY_OLD=$minio_access_key_old"
|
||||
fi
|
||||
|
||||
docker run -p $minio_port:$minio_port $opts -v /mnt/data:/data minio/minio server /data
|
||||
docker-compose --env-file hosting.properties up
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
function dockerInstalled {
|
||||
echo "Checking docker installation..."
|
||||
if [ ! -x "$(command -v docker)" ]; then
|
||||
echo "Please install docker to continue"
|
||||
exit -1
|
||||
fi
|
||||
}
|
||||
|
||||
dockerInstalled
|
||||
|
||||
source "${BASH_SOURCE%/*}/hosting.properties"
|
||||
|
||||
opts="-e MINIO_ACCESS_KEY=$minio_access_key -e MINIO_SECRET_KEY=$minio_secret_key"
|
||||
if [ -n "$minio_secret_key_old" ] && [ -n "$minio_access_key_old" ]; then
|
||||
opts="$opts -e MINIO_SECRET_KEY_OLD=$minio_secret_key_old -e MINIO_ACCESS_KEY_OLD=$minio_access_key_old"
|
||||
fi
|
||||
|
||||
docker run -p $minio_port:$minio_port $opts -v /mnt/data:/data minio/minio server /data
|
|
@ -4,12 +4,16 @@ WORKDIR /app
|
|||
|
||||
ENV CLOUD=1
|
||||
ENV COUCH_DB_URL=https://couchdb.budi.live:5984
|
||||
env BUDIBASE_ENVIRONMENT=PRODUCTION
|
||||
ENV BUDIBASE_ENVIRONMENT=PRODUCTION
|
||||
|
||||
# copy files and install dependencies
|
||||
COPY . ./
|
||||
RUN yarn
|
||||
RUN yarn
|
||||
|
||||
EXPOSE 4001
|
||||
|
||||
# have to add node environment production after install
|
||||
# due to this causing yarn to stop installing dev dependencies
|
||||
# which are actually needed to get this environment up and running
|
||||
ENV NODE_ENV=production
|
||||
CMD ["yarn", "run:docker"]
|
||||
|
|
Loading…
Reference in New Issue