Skip to content

Commit

Permalink
Refactoring, remove default root password and unecessary syslog config
Browse files Browse the repository at this point in the history
  • Loading branch information
Soubinan committed Dec 14, 2023
1 parent a0a7df9 commit 5a17db5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 28 deletions.
3 changes: 1 addition & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ COPY ./rocky.repo /etc/yum.repos.d/rocky.repo
RUN yum clean all && \
yum update -y && \
yum upgrade --refresh -y && \
yum clean all
RUN yum install cloudstack-management hostname -y && \
yum install cloudstack-management hostname -y && \
yum clean all
RUN wget https://download.cloudstack.org/tools/vhd-util -O /usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver/vhd-util

Expand Down
2 changes: 0 additions & 2 deletions cloudstack-init.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Default credentials to be updated
DB_HOST=mysql
DB_ADM_USER=root
DB_ADM_PASSWD=root
DB_CS_USER=cloud
DB_CS_PASSWD=cloud
ENCRYPTION_TYPE=file
Expand Down
8 changes: 3 additions & 5 deletions cloudstack-init.service
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
[Unit]
Description=Cloudstack Setup Initialization
After=network.target
ConditionPathExists=!/etc/default/.cloudstack-provisionned__

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/default/cloudstack-init
ExecStart=/usr/bin/cloudstack-setup-databases ${DB_CS_USER}:${DB_CS_PASSWD}@${DB_HOST} --deploy-as=${DB_ADM_USER}:${DB_ADM_PASSWD} -e ${ENCRYPTION_TYPE} -m ${MGT_SERVER_KEY} -k ${DB_KEY}
ExecStart=/usr/bin/cloudstack-setup-databases ${DB_CS_USER}:${DB_CS_PASSWD}@${DB_HOST} --schema-only -e ${ENCRYPTION_TYPE} -m ${MGT_SERVER_KEY} -k ${DB_KEY}
ExecStart=/usr/bin/cloudstack-setup-management

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cloudstack
ExecStart=/usr/bin/touch /etc/default/.cloudstack-provisionned__

[Install]
WantedBy=multi-user.target
6 changes: 1 addition & 5 deletions cloudstack-management.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
Description=CloudStack Management Server
After=syslog.target network.target mariadb.service mysqld.service mysql.service
Wants=mariadb.service mysqld.service mysql.service
ConditionPathExists=/etc/default/.cloudstack-provisionned__

[Service]
UMask=0022
Type=simple
User=cloud
EnvironmentFile=/etc/default/cloudstack-management
WorkingDirectory=/var/log/cloudstack/management
PIDFile=/var/run/cloudstack-management.pid
ExecStart=/usr/bin/java $JAVA_DEBUG $JAVA_OPTS -cp $CLASSPATH $BOOTSTRAP_CLASS

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cloudstack

[Install]
WantedBy=multi-user.target
24 changes: 10 additions & 14 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ services:
- IPC_LOCK
volumes:
- ./cloudstack-init.env:/etc/default/cloudstack-init:Z
# - cs-config:/etc/cloudstack:Z
# - cs-data:/var/cloudstack:Z
- cs-config:/etc/cloudstack:Z
- cs-data:/var/cloudstack:Z
logging: &default_logging
driver: "json-file"
options:
Expand All @@ -29,24 +29,20 @@ services:
mysql:
image: docker.io/library/mysql:8.0-debian
restart: unless-stopped
ports:
- 3306:3306
expose:
- 3306
volumes:
- ./cloudstack.cnf:/etc/mysql/conf.d/cloudstack.cnf:Z
# - mysql-data:/var/lib/mysql:Z
- mysql-data:/var/lib/mysql:Z
environment:
- MYSQL_ROOT_PASSWORD=root
logging:
<<: *default_logging

# To be uncommented if you want to persist your data
#
# volumes:
# cs-config:
# driver: local
# cs-data:
# driver: local
# mysql-data:
# driver: local
volumes:
cs-config:
driver: local
cs-data:
driver: local
mysql-data:
driver: local

0 comments on commit 5a17db5

Please sign in to comment.