Skip to content

Instantly share code, notes, and snippets.

@fitzgeraldsteele
Last active July 21, 2023 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitzgeraldsteele/9d9cae3bb295d7ccc10317d5e7545ed6 to your computer and use it in GitHub Desktop.
Save fitzgeraldsteele/9d9cae3bb295d7ccc10317d5e7545ed6 to your computer and use it in GitHub Desktop.
Simple cloud init for application health
#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