Cloud-config: Difference between revisions
From Federal Burro of Information
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
- nodejs | - nodejs | ||
- npm | - npm | ||
- vim | |||
- iputils-ping | |||
- lsof | |||
- telnet | |||
- iptraf-ng | |||
- apt-utils | |||
write_files: | write_files: | ||
Line 40: | Line 47: | ||
}) | }) | ||
runcmd: | runcmd: | ||
- echo "curl agent" | |||
- curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh | - curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh | ||
- echo "bash script" | |||
- bash add-monitoring-agent-repo.sh | - bash add-monitoring-agent-repo.sh | ||
- echo "apt update | |||
- apt-get update | - apt-get update | ||
- apt-get install -y | - apt-get install -y "stackdriver-agent" | ||
- service stackdriver-agent start | - service stackdriver-agent start | ||
- service nginx restart | - service nginx restart | ||
Line 52: | Line 62: | ||
</pre> | </pre> | ||
[[/nat box]] |
Latest revision as of 21:48, 31 July 2022
sample file:
source: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-automate-vm-deployment
#cloud-config package_update: true package_upgrade: true packages: - nginx - nodejs - npm - vim - iputils-ping - lsof - telnet - iptraf-ng - apt-utils write_files: - owner: www-data:www-data path: /etc/nginx/sites-available/default content: | server { listen 80; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } - owner: azureuser:azureuser path: /home/azureuser/myapp/index.js content: | var express = require('express') var app = express() var os = require('os'); app.get('/', function (req, res) { res.send('Hello World from host ' + os.hostname() + '!') }) app.listen(3000, function () { console.log('Hello world app listening on port 3000!') }) runcmd: - echo "curl agent" - curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh - echo "bash script" - bash add-monitoring-agent-repo.sh - echo "apt update - apt-get update - apt-get install -y "stackdriver-agent" - service stackdriver-agent start - service nginx restart - cd "/home/azureuser/myapp" - npm init - npm install express -y - nodejs index.js