Rundeck Docker install

Docker
DockerHub images: https://hub.docker.com/r/rundeck/rundeck/
Docker Environment Variables: https://docs.rundeck.com/docs/administration/configuration/docker.html#environment-variables

apt install -y docker docker-compose git vim
git clone https://github.com/rundeck/docker-zoo.git
 
# https://github.com/rundeck/docker-zoo/tree/master/cloud
cd ./docker-zoo/cloud
mkdir libext
wget https://github.com/rundeck-plugins/rundeck-s3-log-plugin/releases/download/v1.0.8/rundeck-s3-log-plugin-1.0.8.jar -P ./libext/
 
# configure paramter
# https://docs.rundeck.com/docs/administration/configuration/docker.html#user-authentication
 
# todo: configure S3
# configure rundeck external address
HOST_IP=$(hostname -I | cut -d" " -f3)
HOST_IP=rundeck.dev.i.example.com
echo "
AWS_CREDENTIALS=x
RUNDECK_PLUGIN_EXECUTIONFILESTORAGE_S3_BUCKET=y
RUNDECK_PLUGIN_EXECUTIONFILESTORAGE_S3_REGION=z
RUNDECK_STORAGE_PASSWORD=p
 
#RUNDECK_GRAILS_URL=\"http://${HOST_IP}\"
#RUNDECK_SERVER_ADDRESS=${HOST_IP}
" > .env.dist
 
# diff docker-compose.yml.org docker-compose.yml
# diff docker-compose.yml.org docker-compose.yml
13c13
<             RUNDECK_GRAILS_URL: http://localhost
---
>             RUNDECK_GRAILS_URL: http://rundeck.dev.example.com
26c26
<           - ${AWS_CREDENTIALS}:/home/rundeck/.aws/credentials
---
>             #  - ${AWS_CREDENTIALS}:/home/rundeck/.aws/credentials
 
# configure SMTP
sed "/RUNDECK_DATABASE_URL:.*:/a \\\t    RUNDECK_MAIL_SMTP_HOST: smtp" docker-compose.yml
 
docker-compose build
docker-compose up
 
docker update --restart unless-stopped cloud_nginx_1
docker update --restart unless-stopped cloud_rundeck_1
docker update --restart unless-stopped cloud_mysql_1

Fix SCM

# scm directory
cd /var/lib/docker/vfs/dir/*/home/rundeck/projects/OpenStack/scm
git config --global --add safe.directory /var/lib/docker/vfs/dir/xxxxxxxxxxxxxxxxxx/home/rundeck/projects/OpenStack/scm
 
docker exec -it -u root docker_rundeck_1 bash
apt update
apt install git
 
docker cp /tmp/id_rsa docker_rundeck_1:/tmp/
docker cp /tmp/id_rsa.pub docker_rundeck_1:/tmp/
 
docker exec -it -u root docker_rundeck_1 bash
ssh git@git.i.ewcs.ch -i /tmp/id_rsa
cd /home/rundeck/projects/OpenStack/scm/import
GIT_SSH_COMMAND="ssh -i /tmp/id_rsa" git pull

Change user / admin password in Docker container

ssh rundeck.dev.i.example.com
RD_USER=admin
RD_PASSWORD_OLD="admin"
RD_PASSWORD="my_new_pass"
docker exec -it rundeck_rundeck_1 sed -i "/^${RD_USER}/ s|:${RD_PASSWORD_OLD}|:${RD_PASSWORD}|g" /home/rundeck/server/config/realm.properties
docker restart rundeck_rundeck_1

OLD

# Create container with shared SSH keys an forward GUI to localhost
sudo docker run --name rundeck -p 4440:4440 -v /home/${USER}/.ssh:/home/rundeck/.ssh rundeck/rundeck:SNAPSHOT
 
# Credentials
url: http://127.0.0.1:4440/
user: admin
pass: admin

Create SSH key

ssh-keygen -m PEM -t ed25519 -f ~/.ssh/id_ed25519 -N "" -C "rundeck@rundeck.dev.example.com"

Update Rundeck container with Docker compose

docker-compose pull
docker-compose up --detach
docker image prune --all --force
 
# Workaround: configure admin 
RD_USER=admin
RD_PASS_OLD="admin"
 RD_PASS_NEW="my_new_pass"
docker exec -it docker_rundeck_1 sed -i "/^${RD_USER}/ s|:${RD_PASS_OLD}|:${RD_PASS_NEW}|g" /home/rundeck/server/config/realm.properties
#docker restart rundeck_rundeck_1

Links
https://docs.rundeck.com/docs/administration/install/docker.html#open-source-rundeck
https://github.com/x110dc/docker-rundeck