Skip to content

Commit

Permalink
docker build with community server
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r3n committed Sep 6, 2023
1 parent 4d99ff5 commit 96ca951
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 230 deletions.
52 changes: 51 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
[Docker Instructions](/docs/docs/gettingstarted/docker.md)
# Conductor Docker Builds

## Pre-built docker images

Conductor server with support for the following backend:
1. Redis
2. Postgres
3. Mysql
4. Cassandra

```shell
docker pull docker.orkes.io/conductor:latest
```

### Docker File for Server and UI

[Docker Image Source for Server with UI](serverAndUI/Dockerfile)

#### Pre-requisites for building
1. [Docker](https://www.docker.com/)
2. [Node](https://nodejs.org/en)
3. [JDK](https://openjdk.org/)

### Configuration Guide for Conductor Server
Conductor uses a persistent store for managing state.
The choice of backend is quite flexible and can be configured at runtime using `conductor.db.type` property.

Refer to the table below for various supported backend and required configurations to enable each of them.

| Backend | Property | Required Configuration |
|------------|------------------------------------|------------------------|
| postgres | conductor.db.type=postgres | |
| redis | conductor.db.type=redis_standalone | |
| mysql | conductor.db.type=mysql | |
| cassandra | conductor.db.type=cassandra | |

Conductor using Elasticsearch for indexing the workflow data.
Currently, Elasticsearch 6 and 7 are supported.
We welcome community contributions for other indexing backends.

**Note:** Docker images use Elasticsearch 7.

### Recommended Configuration for the server
```properties

```

## Helm Charts
TODO: Link to the helm charts

## Run Docker Compose Locally
51 changes: 43 additions & 8 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,66 @@
# ===========================================================================================================
# 0. Builder stage
# ===========================================================================================================
FROM eclipse-temurin:11-jdk-jammy AS builder
FROM alpine:3.18 AS builder

LABEL maintainer="Netflix OSS <conductor@netflix.com>"

# Copy the project directly onto the image
# ===========================================================================================================
# 0. Build Conductor Server
# ===========================================================================================================


# Install dependencies
RUN apk add openjdk11
RUN apk add git
RUN apk add --update nodejs npm yarn

COPY . /conductor
WORKDIR /conductor
WORKDIR /conductor/ui
RUN yarn install && yarn build
RUN ls -ltr
RUN echo "Done building UI"

# Checkout the community project
WORKDIR /
RUN mkdir server-build
WORKDIR server-build
RUN ls -ltr

RUN git clone https://github.com/Netflix/conductor-community.git

# Copy the project directly onto the image
WORKDIR conductor-community
RUN ls -ltr

# Build the server on run
RUN ./gradlew build -x test --stacktrace
WORKDIR /server-build
RUN ls -ltr
RUN pwd

# ===========================================================================================================
# 1. Bin stage
# ===========================================================================================================
FROM eclipse-temurin:11-jre-jammy

FROM alpine:3.18
LABEL maintainer="Netflix OSS <conductor@netflix.com>"

RUN apk add openjdk11
RUN apk add nginx

# Make app folders
RUN mkdir -p /app/config /app/logs /app/libs

# Copy the compiled output to new image
COPY --from=builder /conductor/docker/server/bin /app
COPY --from=builder /conductor/docker/server/config /app/config
COPY --from=builder /conductor/server/build/libs/conductor-server-*-boot.jar /app/libs
COPY docker/server/bin /app
COPY docker/server/config /app/config
COPY --from=builder /server-build/conductor-community/community-server/build/libs/*boot*.jar /app/libs/conductor-server.jar

# Copy compiled UI assets to nginx www directory
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /conductor/ui/build .
COPY --from=builder /conductor/docker/server/nginx/nginx.conf /etc/nginx/http.d/default.conf

# Copy the files for the server into the app folders
RUN chmod +x /app/startup.sh
Expand Down
7 changes: 5 additions & 2 deletions docker/server/bin/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# startup.sh - startup script for the server docker image

echo "Starting Conductor server"
echo "Running Nginx in background"
# Start nginx as daemon
nginx

# Start the server
cd /app/libs
Expand All @@ -25,12 +28,12 @@ export config_file=
if [ -z "$CONFIG_PROP" ];
then
echo "Using an in-memory instance of conductor";
export config_file=/app/config/config-local.properties
export config_file=/app/config/config.properties
else
echo "Using '$CONFIG_PROP'";
export config_file=/app/config/$CONFIG_PROP
fi

echo "Using java options config: $JAVA_OPTS"

java ${JAVA_OPTS} -jar -DCONDUCTOR_CONFIG_FILE=$config_file conductor-server-*-boot.jar 2>&1 | tee -a /app/logs/server.log
java ${JAVA_OPTS} -jar -DCONDUCTOR_CONFIG_FILE=$config_file conductor-server.jar 2>&1 | tee -a /app/logs/server.log
27 changes: 5 additions & 22 deletions docker/server/config/config.properties
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
# Servers.
conductor.grpc-server.enabled=false

# Database persistence type.
conductor.db.type=dynomite

# Dynomite Cluster details.
# format is host:port:rack separated by semicolon
conductor.redis.hosts=dyno1:8102:us-east-1c

# Dynomite cluster name
conductor.redis.clusterName=dyno1

# Namespace for the keys stored in Dynomite/Redis
conductor.db.type=redis_standalone
conductor.redis.hosts=localhost:6379:us-east-1c
conductor.redis-lock.serverAddress=redis://localhost:6379
conductor.redis.taskDefCacheRefreshInterval=1
conductor.redis.workflowNamespacePrefix=conductor

# Namespace prefix for the dyno queues
conductor.redis.queueNamespacePrefix=conductor_queues

# No. of threads allocated to dyno-queues (optional)
queues.dynomite.threads=10

# By default with dynomite, we want the repairservice enabled
conductor.app.workflowRepairServiceEnabled=true

# Non-quorum port used to connect to local redis. Used by dyno-queues.
# When using redis directly, set this to the same port as redis server
# For Dynomite, this is 22122 by default or the local redis-server port used by Dynomite.
conductor.redis.queuesNonQuorumPort=22122

# Elastic search instance indexing is enabled.
conductor.indexing.enabled=true

# Transport address to elasticsearch
conductor.elasticsearch.url=http://es:9200
conductor.elasticsearch.url=http://localhost:9200

# Name of the elasticsearch cluster
conductor.elasticsearch.indexName=conductor
Expand Down
50 changes: 50 additions & 0 deletions docker/server/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
server {
listen 5000;
server_name conductor;
server_tokens off;

location / {
add_header Referrer-Policy "strict-origin";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' assets.orkes.io *.googletagmanager.com *.pendo.io https://cdn.jsdelivr.net; worker-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob:;";
add_header Permissions-Policy "accelerometer=(), autoplay=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), usb=(), xr-spatial-tracking=(), clipboard-read=(self), clipboard-write=(self), gamepad=(), hid=(), idle-detection=(), serial=(), window-placement=(self)";
# This would be the directory where your React app's static files are stored at
root /usr/share/nginx/html;
try_files $uri /index.html;
}

location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8080/api;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}

location /actuator {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8080/actuator;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}

location /swagger-ui {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8080/swagger-ui;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}

}
63 changes: 0 additions & 63 deletions docker/serverAndUI/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions docker/serverAndUI/README.md

This file was deleted.

36 changes: 0 additions & 36 deletions docker/serverAndUI/bin/startup.sh

This file was deleted.

33 changes: 0 additions & 33 deletions docker/serverAndUI/config/config-local.properties

This file was deleted.

Loading

0 comments on commit 96ca951

Please sign in to comment.