added mariadb to docker stack

Signed-off-by: Marc Ahlgrim <marc@onemarcfifty.com>
This commit is contained in:
Marc Ahlgrim 2022-09-12 09:54:34 +02:00
parent 36dddd6f03
commit 0c87745fb4
5 changed files with 68 additions and 6 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

View File

@ -5,17 +5,29 @@ FROM rundeck/rundeck:4.4.0
USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update && \
apt-get -y install \
apt-transport-https \
python3-pip
python3-pip \
sudo \
wget \
curl \
git \
nmap
RUN pip install --upgrade pip
RUN pip install ansible
RUN wget https://github.com/coder/code-server/releases/download/v4.6.0/code-server_4.6.0_amd64.deb
RUN apt -y install ./code-server_4.6.0_amd64.deb
USER rundeck
# now make sure the vscode server gets started at runtime
RUN echo 'export PASSWORD=$VSCODE_PASSWORD' >docker-lib/includes/120_vscode.sh
RUN echo 'pidof node || /usr/bin/code-server --host 0.0.0.0 &' >>docker-lib/includes/120_vscode.sh
RUN chmod 755 docker-lib/includes/120_vscode.sh
#VOLUME ["/home/rundeck/server/data"]

View File

@ -5,10 +5,23 @@ version: '3'
services:
rundeck:
build: .
build:
context: .
container_name: rundeck
restart: on-failure:5
environment:
RUNDECK_GRAILS_URL: http://127.0.0.1:4440
links:
- mariadb
depends_on:
- mariadb
env_file:
.env
ports:
- 4440:4440
- 8080:8080
mariadb:
image: mariadb:10.5.8
container_name: mariadb
restart: on-failure:5
env_file:
.env

View File

@ -0,0 +1,36 @@
#!/bin/bash
# this script creates random passwords
# and updates the .env file
# create a new environment file
# random password for Database connection
RANDOMPASSWORD=`date +%s | sha256sum | base64 | head -c 32`
# the hostname which we can use in order to access rundeck
# from the outside.
# we set this to the hostname of the docker host
GRAILS_HOST_NAME=`hostname`
(cat >.env) <<EOF
# a random password for database connection
RUNDECK_DATABASE_USERNAME=rundeck
RUNDECK_DATABASE_PASSWORD=$RANDOMPASSWORD
RUNDECK_DATABASE_DRIVER=org.mariadb.jdbc.Driver
RUNDECK_GRAILS_URL=http://${GRAILS_HOST_NAME}:4440
RUNDECK_DATABASE_URL=jdbc:mysql://mariadb/rundeck?autoReconnect=true&useSSL=false
MARIADB_DATABASE=rundeck
MYSQL_DATABASE=rundeck
MARIADB_RANDOM_ROOT_PASSWORD=yes
MYSQL_RANDOM_ROOT_PASSWORD=yes
#MARIADB_MYSQL_LOCALHOST_USER=rundeck
#MARIADB_MYSQL_LOCALHOST_GRANTS=all
MARIADB_USER=rundeck
MARIADB_PASSWORD=$RANDOMPASSWORD
MYSQL_USER=rundeck
MYSQL_PASSWORD=$RANDOMPASSWORD
VSCODE_PASSWORD=onemarcfifty
EOF
RANDOMPASSWORD="nothing here"

View File

@ -46,7 +46,7 @@
- name: Add a new user named ansiblessh
user:
name=ansiblessh
password={{ ansiblessh_password }}
password={{ ansible_user_password }}
- name: Add ansiblessh user to the sudoers
copy: