Skip to content

Commit

Permalink
updating root finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardTMiles committed Jan 26, 2025
1 parent 4f4c393 commit 1c8a3f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
8 changes: 3 additions & 5 deletions .github/assets/service/aws_deployment_boot_scripts.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ OnFailure=aws_deployment_failure.service
Type=oneshot
KillMode=process
User=apache
ExecStartPre=/bin/ls --color=always -lah /var/aws-deployment/
ExecStartPre=/home/apache/setup_apache_sites.sh
ExecStartPre=/usr/bin/systemctl enable httpd
ExecStartPre=/usr/bin/systemctl start httpd
ExecStart=/var/aws-deployment/signalLifecycleAction.sh 0
ExecStart=/home/apache/setup_apache_sites.sh
ExecStartPost=/usr/bin/systemctl start aws_deployment_root_finalize.service


[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions .github/assets/service/aws_deployment_root_finalize.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=Finalize AWS Deployment (Signal Success and Set Permissions)
After=aws_deployment_boot_scripts.service
Requires=aws_deployment_boot_scripts.service
PartOf=aws_deployment_boot_scripts.service
OnFailure=aws_deployment_failure.service

[Service]
Type=oneshot
KillMode=process
User=root
ExecStartPre=/usr/bin/chmod 755 /etc/httpd/conf.d/
ExecStartPre=/usr/bin/systemctl enable httpd
ExecStartPre=/usr/bin/systemctl start httpd
ExecStart=/var/aws-deployment/signalLifecycleAction.sh 0

[Install]
WantedBy=multi-user.target
7 changes: 4 additions & 3 deletions .github/assets/shell/deployUserDataScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ EOF

# Run the SSH setup function as the apache user; just keep both arguments passed as it makes reading the script easier
echo "Setting up SSH for apache user..."
chmod 777 /etc/httpd/conf.d/
sudo -u apache bash -c "$(declare -f setup_ssh_for_apache); setup_ssh_for_apache \"$1\" \"$2\""
chmod 755 /etc/httpd/conf.d/

# Download Apache Sites Setup Script
chown -R apache:apache /var/www/
Expand All @@ -103,7 +101,10 @@ curl -o /etc/systemd/system/aws_deployment_failure.service \
curl -o /etc/systemd/system/aws_deployment_boot_scripts.service \
"https://raw.githubusercontent.com/MilesSystems/aws-deployment/${1}/.github/assets/service/aws_deployment_boot_scripts.service"

# Enable the failure service
chmod 777 /etc/httpd/conf.d/
ls -lah /etc/httpd/conf.d/

# Run the Apache Sites Setup Script in a custom service
systemctl enable "aws_deployment_boot_scripts"
systemctl start "aws_deployment_boot_scripts"

0 comments on commit 1c8a3f9

Please sign in to comment.