Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/hack/test-templates/static-port-forward.yaml
1639 views
1
images:
2
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
3
arch: "x86_64"
4
5
provision:
6
- mode: system
7
script: |
8
apt-get update
9
apt-get install -y nginx python3
10
systemctl enable nginx
11
systemctl start nginx
12
13
cat > /etc/systemd/system/test-server-9080.service << 'EOF'
14
[Unit]
15
Description=Test Server on Port 9080
16
After=network.target
17
18
[Service]
19
Type=simple
20
User=root
21
ExecStart=/usr/bin/python3 -m http.server 9080 --bind 127.0.0.1
22
Restart=always
23
24
[Install]
25
WantedBy=multi-user.target
26
EOF
27
28
cat > /etc/systemd/system/test-server-9070.service << 'EOF'
29
[Unit]
30
Description=Test Server on Port 9070
31
After=network.target
32
33
[Service]
34
Type=simple
35
User=root
36
ExecStart=/usr/bin/python3 -m http.server 9070 --bind 127.0.0.1
37
Restart=always
38
39
[Install]
40
WantedBy=multi-user.target
41
EOF
42
43
mkdir -p /var/www/html-9080
44
mkdir -p /var/www/html-9070
45
46
echo '<html><body><h1>Dynamic port 9080</h1></body></html>' > /var/www/html-9080/index.html
47
echo '<html><body><h1>Dynamic port 9070</h1></body></html>' > /var/www/html-9070/index.html
48
49
systemctl daemon-reload
50
systemctl enable test-server-9080
51
systemctl enable test-server-9070
52
systemctl start test-server-9080
53
systemctl start test-server-9070
54
55
portForwards:
56
- guestPort: 80
57
hostPort: 9090
58
static: true
59
- guestPort: 9080
60
hostPort: 9080
61
static: false
62
- guestPort: 9070
63
hostPort: 9070
64
static: false
65
66