Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker improvements #110

Merged
merged 9 commits into from
Jul 11, 2022
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ install/logging/logstash-*.zip

# JaCoCo Reports
/target
/jacoco-reports
/jacoco-reports
/test-screenshots
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# --------
# build.sh
# --------
Expand Down
10 changes: 8 additions & 2 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# --------
# dev.sh
# --------
Expand Down Expand Up @@ -73,7 +73,13 @@ BASE_PORT=8000
tab ${DIST}/console-only/cws "./start_cws.sh -d $BASE_PORT; tail -f $LOG_FILE"

print "Waiting for console startup..."
sleep 180
cws_console_host=$(grep cws_console_host ${ROOT}/auto_conf_console.dat | cut -d '=' -f2)
cws_console_ssl_port=$(grep cws_console_ssl_port ${ROOT}/auto_conf_console.dat | cut -d '=' -f2)
while ! curl -k -s https://${cws_console_host}:${cws_console_ssl_port}/cws-ui/login > /dev/null 2>&1; do
sleep 5
print "Retry wait for console"
done
print "Console is now running!"

# -----------------
# CONFIGURE WORKERS
Expand Down
28 changes: 25 additions & 3 deletions install/docker/console-db-es-ls-kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,33 @@

### Quickly run common-workflow-service on a single machine with all required services running on the same machine.

## Prerequisites:
#### It will deploy the following services in Docker:
- db (MariaDb)
- es (Elasticsearch)
- cws (CWS console)
- cws-worker1 (CWS Worker)

1. Build `common-workflow-image` Docker Image using the `build.sh` script in the cws-image dir
2. Update the `config.properties` and `docker-compose.yml` accordingly.
### Prerequisites:

1. Be sure to increase your Docker Resources to at least 4 CPUs and 10GB memory
2. Build `common-workflow-service` Docker Image using the `build.sh` script in the cws-image dir
1. Update the version in the `build.sh` script if necessary
3. Update the `config.properties` and `docker-compose.yml` accordingly.
4. Run the command `docker network create cws-network` to create a shared network space for other workers to join

To run use the command:

docker-compose up

## Adding more workers

### Prerequisites:

1. Be sure to increase your Docker Resources and add 4GB memory per extra worker you want to run
2. You can easily add another worker (worker2) to this deployment by doing the following:
1. `cd ../worker-ls` (Change to the worker-ls directory)
2. `docker-compose up` (Startup worker2)
3. If you want to add even more workers you'll need to do the following:
1. Copy the `worker-ls` directory to a new location
2. Modify those `config.properites` and `docker-compose.yml` accordingly.
3. Run `docker-compose up` in each new worker directory
8 changes: 5 additions & 3 deletions install/docker/console-db-es-ls-kibana/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ hostname=cws-console

# This is the type of installation you are performing
# (1 = Console and Worker, 2 = Console Only, 3 = Worker Only)
install_type=1
install_type=2

database_type=mariadb

Expand Down Expand Up @@ -101,20 +101,22 @@ cws_enable_cloud_autoscaling=n
# Specifies (comma separated) email addresses that will be used to receive
# email alerts of major system errors, which include database connection failures,
# messaging service (JMS) failures, and authentication server connection failures.
cws_notification_emails=[AdminEmailAddresses(comma separated)]
cws_notification_emails=[email protected]

# This allows CWS to use a user provided Elasticsearch service.
# If you wish to use an unsecured Elasticsearch host, you may do so
# by specifying elasticsearch_use_auth=n below.
elasticsearch_protocol=http
elasticsearch_use_auth=n
elasticsearch_host=http://es
elasticsearch_host=es
elasticsearch_port=9200

# This allows CWS to use a user provided Logstash service, thus CWS will not install
# nor start its own.
user_provided_logstash=n

history_level=full
history_days_to_live=1

# Specifies the number of hours that a CWS security token is valid for. After this
# amount of time it will expire, and the User will be required to authenticate
Expand Down
2 changes: 1 addition & 1 deletion install/docker/console-db-es-ls-kibana/cws-logstash.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ input {
}
}
file {
path => "__CWS_CATALINA_OUT_PATH__/catalina.out"
path => "/cws_logs/catalina.out"
codec => multiline {
pattern => "(^%{MONTH} %{MONTHDAY}, 20%{YEAR} %{HOUR}:?%{MINUTE}(?::?%{SECOND}) (?:AM|PM))|(^%{TIMESTAMP_ISO8601})|(^%{MONTHDAY}-%{MONTH}-%{YEAR} %{TIME})"
negate => true
Expand Down
70 changes: 52 additions & 18 deletions install/docker/console-db-es-ls-kibana/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
db:
restart: always
image: mariadb:10.3
#image: arm64v8/mariadb:10.3 # Use this image for Mac M1/M2 arm64
container_name: cws-db
ports:
- "3306:3306"
Expand All @@ -17,17 +18,18 @@ services:
interval: 3s
timeout: 1s
retries: 5
networks:
- backend
# networks:
# - backend
es:
labels:
com.example.service: "es"
com.example.description: "For searching and indexing data"
image: elasticsearch:7.16.2
#image: arm64v8/elasticsearch:7.16.2 # Use this image for Mac M1/M2 arm64
container_name: cws-es
networks:
- frontend
- backend
# networks:
# - frontend
# - backend
ports:
- "9200:9200"
- "9300:9300"
Expand Down Expand Up @@ -61,18 +63,18 @@ services:
# - frontend
# - backend
# environment:
# - ELASTICSEARCH_URL=http://es:9200
# - ELASTICSEARCH_HOSTS=http://es:9200
# depends_on:
# - es
# logstash:
# labels:
# com.example.service: "logstash"
# com.example.description: "For logging data"
# image: docker.elastic.co/logstash/logstash:7.16.2
# container_name: cws_logstash
# image: arm64v8/logstash:7.16.2
# container_name: cws-logstash
# volumes:
# - ./cws-logstash.conf:/home/cws_user/cws-logstash.conf:ro
# - logs-volume:/cws_logs:ro
# - logs-volume:/cws_logs
# command: logstash -f /home/cws_user/cws-logstash.conf
# environment:
# - XPACK_MONITORING_ENABLED=false
Expand All @@ -93,7 +95,8 @@ services:
labels:
com.example.service: "cws-server"
com.example.description: "Common Workflow Service"
image: nasa-ammos/common-workflow-service:2.2.0 # update this each CWS release
image: nasa-ammos/common-workflow-service:2.3.0-alpha.6 # update this each CWS release
#image: arm64v8/nasa-ammos/common-workflow-service:2.3.0-alpha.6 # Use this image for Mac M1/M2 arm64
depends_on:
- db
- es
Expand All @@ -104,24 +107,55 @@ services:
- "38443:38443"
- "31616:31616"
hostname: cws-console
networks:
- frontend
- backend
# networks:
# - frontend
# - backend
environment:
- DB_HOST=db
- DB_USER=root
- DB_PW=test
- ES_HOST=http://es
- ES_PROTOCOL=http
- ES_HOST=es
- ES_PORT=9200
healthcheck:
test: ["CMD-SHELL", "curl -k --silent --fail https://localhost:38443/cws-ui/login || exit 1"]
interval: 5s
timeout: 2s
retries: 12
volumes:
- ./config.properties:/home/cws_user/config.properties:ro
- logs-volume:/home/cws_user/cws/server/apache-tomcat-9.0.33/logs
cws-worker:
container_name: cws-worker1
labels:
com.example.service: "cws-worker1"
com.example.description: "Common Workflow Service"
image: nasa-ammos/common-workflow-service:2.3.0-alpha.6 # update this each CWS release
#image: arm64v8/nasa-ammos/common-workflow-service:2.3.0-alpha.6 # Use this image for Mac M1/M2 arm64
depends_on:
- db
- es
- cws
hostname: cws-worker1
# networks:
# - frontend
# - backend
environment:
- DB_HOST=db
- DB_USER=root
- DB_PW=test
- ES_PROTOCOL=http
- ES_HOST=es
- ES_PORT=9200
volumes:
- ./worker-config.properties:/home/cws_user/config.properties:ro
- logs-volume:/home/cws_user/cws/server/apache-tomcat-9.0.33/logs

volumes:
logs-volume:

networks:
frontend:
driver: bridge
backend:
driver: bridge
default:
external:
name: cws-network

103 changes: 103 additions & 0 deletions install/docker/console-db-es-ls-kibana/worker-config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# ---------------------------------------------------------------------------
# This is an example properties file that can be used when configuring CWS
# for the first time.
#
# To use:
#
# 1) Fill in the correct values where you see [YourXXX] below, for example
# [YourHostname].
# The hard-coded values are suggested to be used, but can be changed if
# desired.
#
# 2) Run CWS configuration program with this properties file:
# ./configure.sh config.properties
#
# ---------------------------------------------------------------------------

cws_ldap_url_default=ldaps://ldap.localhost:636
ldap_identity_plugin_class=org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin
ldap_security_filter_class=jpl.cws.core.web.CwsLdapSecurityFilter
camunda_security_filter_class=jpl.cws.core.web.CwsCamundaSecurityFilter
auto_accept_config=y
startup_autoregister_process_defs=false

# This is the hostname of the machine you are installing CWS (could be a Worker,
# a Console, or both) on. The name (or less preferably IP address) you use here
# should be accessible by all other components inthe CWS installation.
hostname=worker1

# This is the type of installation you are performing
# (1 = Console and Worker, 2 = Console Only, 3 = Worker Only)
install_type=3

database_type=mariadb

# This is the hostname where the database is installed.
# This hostname must be accessible by all Workers and Console
database_host=db

database_port=3306

# The name of the database schema.
database_name=cws

# The name of the user that can access, and has CRUD permission to the database
database_username=root

# The password for the database user.
database_password=test

# The LDAP username for the user that will be the CWS Administrator.
# This User will have the initial permissions in CWS, and will have the ability
# to add users and modify permissions.
admin_user=cws

# The first and last name, and email address of the CWS Administrator.
# These fields are only required if using CAMUNDA security
admin_firstname=CWS
admin_lastname=CWS
[email protected]

cws_web_port=39080
cws_ssl_port=39443
cws_ajp_port=39009
cws_shutdown_port=39005

# The host that the CWS platform containing the console is installed on.
# This configuration option only needs to be specified if installing CWS on a
# non-console host.
cws_console_host=cws-console
cws_console_ssl_port=38443

# The host that will contain the CWS message broker. Currently this will always
# be the same as the Console host. If you are installing a Console, enter the
# same hostname as the "hostname" option. If you are installing a Worker, then
# enter the hostname of the console.
amq_host=cws-console
amq_port=31616

cws_jmx_port=31096
identity_plugin_type=CAMUNDA
cws_ldap_url=ldaps://ldap.localhost:636
notify_users_email=y
email_subject=[CWS] You have been assigned a task (CWS_TASK_NAME)
email_body=fn:CWS_USER_FIRSTNAME<br/>ln:CWS_USER_LASTNAME,<br/>tn:(CWS_TASK_NAME), em:CWS_USER_EMAIL

# This allows CWS to use a user provided Logstash service, thus CWS will not install
# nor start its own.
user_provided_logstash=n

history_level=full

# Specifies (comma separated) email addresses that will be used to receive
# email alerts of major system errors, which include database connection failures,
# messaging service (JMS) failures, and authentication server connection failures.
[email protected]

# This allows CWS to use a user provided Elasticsearch service.
# If you wish to use an unsecured Elasticsearch host, you may do so
# by specifying elasticsearch_use_auth=n below.
elasticsearch_protocol=http
elasticsearch_use_auth=n
elasticsearch_host=es
elasticsearch_port=9200
13 changes: 4 additions & 9 deletions install/docker/cws-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
FROM oraclelinux:8
#FROM arm64v8/oraclelinux:8 # Use this image for Mac M1/M2 arm64

RUN yum update -y && \
yum install -y mariadb-server java-1.8.0-openjdk java-1.8.0-openjdk-devel rsync which && \
yum install -y mysql java-1.8.0-openjdk java-1.8.0-openjdk-devel rsync which && \
yum clean all

ENV JAVA_HOME /usr/lib/jvm/java-1.8.0

ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN useradd -ms /bin/bash cws_user && usermod -aG wheel cws_user

WORKDIR /home/cws_user

ADD cws_server.tar.gz .
ADD startup.sh .
ADD wait_for_mariadb.sh .
ADD wait_for_db_es_console.sh .

# For time check
ADD getTime.java .
ADD joda-time-2.1.jar .

RUN chown -R cws_user:cws_user cws

USER cws_user

ENTRYPOINT [ "./wait_for_mariadb.sh" ]
ENTRYPOINT [ "./wait_for_db_es_console.sh" ]
Loading