Last active
July 21, 2023 20:02
-
-
Save fitzgeraldsteele/9d9cae3bb295d7ccc10317d5e7545ed6 to your computer and use it in GitHub Desktop.
Simple cloud init for application health
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx | |
write_files: | |
- path: /var/www/html/index.html | |
content: | | |
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>Hello, World!</h1> | |
</body> | |
</html> | |
owner: www-data:www-data | |
permissions: '0644' | |
- path: /var/www/html/health.html | |
content: | | |
healthy | |
owner: www-data:www-data | |
permissions: '0644' | |
- path: /etc/nginx/sites-available/default | |
content: | | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www/html; | |
index index.html; | |
server_name _; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location /health { | |
try_files $uri.html =404; | |
} | |
} | |
owner: root:root | |
permissions: '0644' | |
runcmd: | |
- systemctl enable nginx | |
- service nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment