Skip to content

Commit

Permalink
Add simple cluster exhibit (rundeck#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahormazabal authored Oct 27, 2023
1 parent 26b97da commit dc80d19
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 0 deletions.
3 changes: 3 additions & 0 deletions simple-cluster/.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Set pro options if applicable
RUNDECK_IMAGE=rundeckpro/enterprise:SNAPSHOT
RUNDECK_LICENSE_FILE=/path/to/licence.file
22 changes: 22 additions & 0 deletions simple-cluster/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Simple Cluster Exhibit
=============

Demonstrates configuring a Rundeck Enterprise Cluster, with NGinx as Load Balancer.

### Setup

- Copy the provided `.env.dist` file as `.env`, and edit the values as needed providing the correct license file.
- If you want to increase the cluster size, you'll need to adjust the `replicas` parameters in the `docker-compose.yml` file.
And also adjust the `upstream` servers in the `nginx.conf` file. This in order to use nginx as actual load balancer
instead of docker's default round-robin load balancer.


### Startup
```
docker-compose up
```

### Teardown
```
docker-compose down -v
```
90 changes: 90 additions & 0 deletions simple-cluster/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

# We fix the project name so DNS names are deterministic
# This in order to use nginx LB in full, instead of docker's dns round-robin strategy.
name: rundeck-cluster

services:
nginx:
image: nginx
depends_on:
rundeck:
condition: service_healthy
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- 80:80

# slim rundeck container to run database setup.
# We do this first to prevent collisions between the two nodes when doing the first setup.
rundeck-migration:
image: ${RUNDECK_IMAGE:-rundeckpro/enterprise:SNAPSHOT}
links:
- dbase
environment:
RUNDECK_EXEC_CMD: "java -jar rundeck.war -m"
RUNDECK_DATABASE_DRIVER: org.mariadb.jdbc.Driver
RUNDECK_DATABASE_USERNAME: rundeck
RUNDECK_DATABASE_PASSWORD: rundeck
RUNDECK_DATABASE_URL: jdbc:mysql://dbase/rundeck?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true


# main cluster
rundeck:
deploy:
replicas: 2 # If this is changed, remember to adjust nginx configuration at nginx.conf
image: rundeck-node
build:
context: rundeck-node
args:
RUNDECK_IMAGE: ${RUNDECK_IMAGE:-rundeckpro/enterprise:SNAPSHOT}
links:
- rundeck-migration
- dbase
depends_on:
rundeck-migration:
condition: service_completed_successfully
environment:
RUNDECK_GRAILS_URL: http://localhost
RUNDECK_DATABASE_DRIVER: org.mariadb.jdbc.Driver
RUNDECK_DATABASE_USERNAME: rundeck
RUNDECK_DATABASE_PASSWORD: rundeck
RUNDECK_DATABASE_URL: jdbc:mysql://dbase/rundeck?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
RUNDECK_SECURITY_DBLOGIN_ENABLED: 'true'
RUNDECK_SECURITY_DBLOGIN_CREATEADMINUSERANDROLES: 'true'
RUNDECK_SECURITY_DBLOGIN_ADMINUSERNAME: admin
RUNDECK_SECURITY_DBLOGIN_ADMINPASSWORD: admin
RUNDECK_PLUGIN_CLUSTER_REMOTEEXECUTION_ENABLED: 'false'
RUNDECK_FEATURE_ENTERPRISEACL_ENABLED: 'false'
RUNDECK_FEATURE_ENTERPRISEACLTRANSFER_ENABLED: 'false'
RUNDECK_SERVER_ADDRESS: 0.0.0.0
RUNDECK_GUI_STARTPAGE: jobs
healthcheck:
test: "curl -f http://localhost:4440"
interval: 5s
timeout: 10s
retries: 50
start_period: 180s
start_interval: 10s
ports:
- 4440
# expose:
# - 4440
volumes:
- logdata:/home/rundeck/var/logs:rw
- ${RUNDECK_LICENSE_FILE:-/dev/null}:/home/rundeck/etc/rundeckpro-license.key

dbase:
image: mysql:8
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: rundeck
MYSQL_USER: rundeck
MYSQL_PASSWORD: rundeck
volumes:
- dbdata_mysql:/var/lib/mysql

volumes:
logdata:
dbdata_mysql:
21 changes: 21 additions & 0 deletions simple-cluster/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
events {
worker_connections 1024;
}

http {
upstream rundeck {
#ip_hash;
server rundeck-cluster-rundeck-1:4440 max_fails=3 fail_timeout=30s;
server rundeck-cluster-rundeck-2:4440 max_fails=3 fail_timeout=30s;
}

server {
location / {
proxy_pass http://rundeck;
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_set_header User-Agent $http_user_agent;
}
}
}
12 changes: 12 additions & 0 deletions simple-cluster/rundeck-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG RUNDECK_IMAGE
FROM ${RUNDECK_IMAGE}

USER root

#Create logs dir path
RUN mkdir -p /home/rundeck/var/logs && \
chown rundeck:root /home/rundeck/var/logs

# Set output log dir as volume so it can be shared across containers
USER rundeck
VOLUME /home/rundeck/var/logs

0 comments on commit dc80d19

Please sign in to comment.