mirror of
https://gitlab.com/ser-cal/m346.git
synced 2024-11-27 02:51:56 +01:00
59 lines
2.2 KiB
YAML
59 lines
2.2 KiB
YAML
|
#cloud-config
|
||
|
users:
|
||
|
- name: ubuntu
|
||
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||
|
groups: users, admin
|
||
|
home: /home/ubuntu
|
||
|
shell: /bin/bash
|
||
|
ssh_authorized_keys:
|
||
|
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0WGP1EZykEtv5YGC9nMiPFW3U3DmZNzKFO5nEu6uozEHh4jLZzPNHSrfFTuQ2GnRDSt+XbOtTLdcj26+iPNiFoFha42aCIzYjt6V8Z+SQ9pzF4jPPzxwXfDdkEWylgoNnZ+4MG1lNFqa8aO7F62tX0Yj5khjC0Bs7Mb2cHLx1XZaxJV6qSaulDuBbLYe8QUZXkMc7wmob3PM0kflfolR3LE7LResIHWa4j4FL6r5cQmFlDU2BDPpKMFMGUfRSFiUtaWBNXFOWHQBC2+uKmuMPYP4vJC9sBgqMvPN/X2KyemqdMvdKXnCfrzadHuSSJYEzD64Cve5Zl9yVvY4AqyBD aws-key
|
||
|
ssh_pwauth: true
|
||
|
disable_root: false
|
||
|
package_update: true
|
||
|
packages:
|
||
|
- curl
|
||
|
- wget
|
||
|
- nginx
|
||
|
- openjdk-18-jre
|
||
|
write_files:
|
||
|
- content: |
|
||
|
[Unit]
|
||
|
Description=Demo Shop
|
||
|
After=syslog.target
|
||
|
[Service]
|
||
|
WorkingDirectory=/var/www/app
|
||
|
User=www-data
|
||
|
ExecStart=java -jar /var/www/app/shopdemo-1.0.0.jar --spring.config.additional-location=production.properties SuccessExitStatus=143
|
||
|
Restart=always
|
||
|
RestartSec=10
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|
||
|
path: /etc/systemd/system/shop-app.service
|
||
|
- content: |
|
||
|
server {
|
||
|
listen 80;
|
||
|
server_name [[Public-IP-Web!]];
|
||
|
location / {
|
||
|
proxy_pass http://127.0.0.1:5001;
|
||
|
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;
|
||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
}
|
||
|
}
|
||
|
path: /home/ubuntu/nginx
|
||
|
runcmd:
|
||
|
- sudo mkdir /var/www
|
||
|
- sudo mkdir /var/www/app
|
||
|
- sudo git clone https://gitlab.com/ch-tbz-it/Stud/m346/m346scripts.git
|
||
|
- sudo sed -i 's/<your-connection-string>/jdbc:mysql:\/\/[[Private-IP-DB!]]:3306\/shop/g' ./m346scripts/KN05/java/production.properties
|
||
|
- sudo cp -r ./m346scripts/KN05/java/* /var/www/app/
|
||
|
- sudo systemctl enable shop-app.service
|
||
|
- sudo systemctl start shop-app.service
|
||
|
- sudo service nginx start
|
||
|
- sudo cp /home/ubuntu/nginx /etc/nginx/sites-available/default
|
||
|
- sudo nginx -s reload
|