Skip to content

Commit d9a6a21

Browse files
authored
Slalom DIGITAL X 2023 (#2)
* slalom * sa and key fix * own image * branch fix * slalom logo * pub temp * os-login fix * paper update * remove favicon * debian 12 * wifi help * text update * limit duration * add quota * test message without button * 4min * short url * timeout * more timeout * e2-micro * e2-micro costs * nano removed * digital x 2023 * new name * python fix
1 parent ab9bc24 commit d9a6a21

26 files changed

+425
-87
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ terraform.rc
4040

4141
*.zip
4242

43+
*.db
44+
4345
sourcerepo-url.sh
4446
variables.sh
4547
dns-name-servers.txt
46-
pi-private-key.json
48+
pi-private-key.json
49+
copy.sh

QUOTA.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ The following quotas can affect scaling.
99
| Identity and Access Management (IAM) API | Service Account Count | | 100 | ✔️ We use one service account for all VMs. |
1010
| Cloud Build API | Concurrent builds | | 30 | ✔️ All jobs are queued. 30 in parallel, then jobs have to wait. |
1111
| Compute Engine API | Static IP addresses | Region | 700 | ⚠️ Seems to be the limiting factor. |
12-
| Compute Engine API | In-use IP addresses | Region | 2300 | > 700 * g1-small |
13-
| Compute Engine API | CPUs | Region | 2400 | > 700 * g1-small |
12+
| Compute Engine API | In-use IP addresses | Region | 2300 | > 700 * e2-micro |
13+
| Compute Engine API | CPUs | Region | 2400 | > 700 * e2-micro |
1414
| Compute Engine API | Persistent Disk SSD (GB) | Region | 82 TB | > 700 * 25 GB |
1515
| Cloud Scheduler API | Jobs | Region | 5000 | > 700 VMs |
1616

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Shells on Demand Appliance (Google Compute Engine)
1+
# Server on Demand Appliance (Google Compute Engine)
22

33
**Get your own Google Compute Engine virtual machine (VM) with the simple push of a button.**
44

5-
[![Image: Shells on Demand Appliance (Google Compute Engine)](./img/soda-gce-photo.jpg)](./img/README.md)
5+
![Image: Server on Demand Appliance (Google Compute Engine)](./img/soda-gce-photo.jpg)
6+
7+
![Image: Server on Demand Appliance at DIGITAL X 2023](./img/soda-gce-digitalx-2023.jpg)
68

79
This project is intended to show how quickly and easily virtual machines can be configured and set up using Google Cloud and Infrastructure as Code (IaC) tools.
810
You have the choice between four Linux based operating systems.
@@ -17,11 +19,11 @@ This project also shows you how well the Google Cloud can scale.
1719
Tested with over 100 VMs. [700 VMs](./QUOTA.md) is the default limit.
1820

1921
## 🤔 Why
20-
I saw the Shells On Demand Appliance "SODA" from National Upcycled Computing Collective (NUCC) at the DEF CON 30 conference in Las Vegas. Unfortunately not in person but in this [YouTube video](https://www.youtube.com/watch?v=e69zcwISo3Y).
22+
I saw the Server on Demand Appliance "SODA" from National Upcycled Computing Collective (NUCC) at the DEF CON 30 conference in Las Vegas. Unfortunately not in person but in this [YouTube video](https://www.youtube.com/watch?v=e69zcwISo3Y).
2123

2224
TL;DR: It's a vending machine. You pay, press a button and get your own virtual machine (VM).
2325

24-
![Image: Shells on Demand Appliance at DEF CON 30](./img/soda-las_vegas.jpg)
26+
![Image: Server on Demand Appliance at DEF CON 30](./img/soda-las_vegas.jpg)
2527

2628
*Image Source: [@strangepartscom](https://twitter.com/strangepartscom/status/1558566808205987840/), [@Zhoratrope](https://twitter.com/Zhoratrope/status/1558160122957799424)*
2729

@@ -94,7 +96,7 @@ The following technologies are used:
9496
</details>
9597

9698

97-
All components put together correctly result in the Shells on Demand Appliance Google Cloud version.
99+
All components put together correctly result in the Server on Demand Appliance Google Cloud version.
98100

99101
## 🪄 Process of creating a VM
100102

@@ -146,25 +148,25 @@ further steps are executed in the cloud.
146148

147149
The following configuration is used by default:
148150

149-
* Machine type: [`g1-small`](https://gcloud-compute.com/g1-small.html)
150-
* vCPU: 1 shared Intel (x86/64)
151-
* Memory: 1.7 GB
151+
* Machine type: [`e2-micro`](https://gcloud-compute.com/e2-micro.html)
152+
* vCPU: 2 shared Intel (x86/64)
153+
* Memory: 1 GB
152154
* Disk:
153155
* Type: [Balanced persistent disk](https://cloud.google.com/compute/docs/disks#disk-types) (SSD)
154156
* Size: 25 GB
155157
* External IP address: Premium
156-
* Region: [`europe-west1`](https://gcloud-compute.com/europe-west1/g1-small.html) (Belgium)
158+
* Region: [`europe-west1`](https://gcloud-compute.com/europe-west1/e2-micro.html) (Belgium)
157159

158160
**Costs:**
159161

160-
Estimated cost per `g1-small` VM, without guarantee:
162+
Estimated cost per `e2-micro` VM, without guarantee:
161163

162164
| | $ 1h | $ 3h |
163165
|------------------|----------|--------|
164-
| CPU and memory | `0.0285` | `0.09` |
166+
| CPU and memory | `0.0092` | `0.03` |
165167
| Disk (25GB)¹ | `0.0034` | `0.01` |
166168
| Static public IP | `0.0034` | `0.01` |
167-
| **Total** | `0.0353` | `0.11` |
169+
| **Total** | `0.0160` | `0.05` |
168170

169171
¹ Disk: 0.1 USD per 1 GB and month,
170172
25 GB per month = 2.50 USD,
@@ -180,7 +182,7 @@ There are other small costs for:
180182
* Cloud DNS managed zone
181183
* Network Internet egress traffic
182184

183-
Source: [Google Cloud Pricing Calculator](https://cloud.google.com/products/calculator/#id=4ca15321-259b-46b4-9cf5-1f48b8536ec7)
185+
Source: [Google Cloud Pricing Calculator](https://cloud.google.com/products/calculator/#id=7b564b38-e2c4-43bc-8e50-9a21b71d0c48)
184186

185187
## 🚀 Setup
186188

cloudbuild/create.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Create VM
22
steps:
3-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
3+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
44
entrypoint: "bash"
55
args:
66
- "-c"
@@ -25,7 +25,7 @@ steps:
2525
# Exit if SHA512 hash is less than 100 chars
2626
if [ $(jq -er '.password' < "/workspace/data.json" | wc -c) -lt "100" ]; then echo "SHA512 password hash too short!"; exit 9; fi
2727
28-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
28+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
2929
entrypoint: "bash"
3030
args:
3131
- "-c"
@@ -37,7 +37,7 @@ steps:
3737
echo "Public Key :"
3838
cat "/workspace/ssh.key.pub" || exit 9
3939
40-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
40+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
4141
entrypoint: "bash"
4242
args:
4343
- "-c"
@@ -75,7 +75,7 @@ steps:
7575
-var="image=$(jq -er '.image' < "/workspace/data.json")" \
7676
-auto-approve || exit 9
7777
78-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
78+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
7979
entrypoint: "bash"
8080
args:
8181
- "-c"
@@ -87,7 +87,7 @@ steps:
8787
echo "'"
8888
bash "/workspace/cloudbuild/wait-for-ssh.sh" || exit 9
8989
90-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
90+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
9191
entrypoint: "bash"
9292
args:
9393
- "-c"

cloudbuild/destroy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Destroy VM
22
steps:
3-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
3+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
44
entrypoint: "bash"
55
args:
66
- "-c"
@@ -13,7 +13,7 @@ steps:
1313
echo 'Project Nr : $PROJECT_NUMBER'
1414
echo 'Region : $LOCATION'
1515
16-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
16+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
1717
entrypoint: "bash"
1818
args:
1919
- "-c"

cloudbuild/gce-vm-ansible.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
append: true
3535

3636
#############################################
37-
# Debian 11 / Ubuntu 22.04 LTS
37+
# Debian 12 / Ubuntu 22.04 LTS
3838
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html
3939
#############################################
4040
- name: Install Lighttpd on Debian
@@ -79,17 +79,12 @@
7979
# Rock Linux 9
8080
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/dnf_module.html
8181
#############################################
82-
- name: Install GNU nano on Rocky Linux
83-
when: ansible_distribution == "Rocky"
84-
ansible.builtin.dnf:
85-
name: nano
86-
state: present
87-
update_cache: true
8882
- name: Install Nginx on Rocky Linux
8983
when: ansible_distribution == "Rocky"
9084
ansible.builtin.dnf:
9185
name: nginx
9286
state: present
87+
update_cache: true
9388
- name: Install PHP on Rocky Linux
9489
when: ansible_distribution == "Rocky"
9590
ansible.builtin.dnf:
@@ -114,17 +109,12 @@
114109
# openSUSE Leap (15)
115110
# https://docs.ansible.com/ansible/latest/collections/community/general/zypper_module.html
116111
#############################################
117-
- name: Install GNU nano on openSUSE
118-
when: ansible_distribution == "openSUSE Leap"
119-
community.general.zypper:
120-
name: nano
121-
state: present
122-
update_cache: true
123112
- name: Install Apache on openSUSE
124113
when: ansible_distribution == "openSUSE Leap"
125114
community.general.zypper:
126115
name: apache2
127116
state: present
117+
update_cache: true
128118
- name: Install PHP on openSUSE
129119
when: ansible_distribution == "openSUSE Leap"
130120
community.general.zypper:

cloudbuild/gce-vm-terraform.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 Nils Knieling
2+
* Copyright 2022-2023 Nils Knieling
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -101,14 +101,14 @@ variable "machine_type" {
101101
type = string
102102
nullable = false
103103
description = "Google Compute Engine machine type"
104-
default = "g1-small"
104+
default = "e2-micro"
105105
}
106106

107107
variable "image" {
108108
type = string
109109
nullable = false
110110
description = "Google Compute Engine operating system image"
111-
default = "debian-cloud/debian-11"
111+
default = "debian-cloud/debian-12"
112112
}
113113

114114
variable "ansible_ssh_pub_key" {
@@ -273,10 +273,10 @@ resource "local_file" "php" {
273273
<head>
274274
<meta charset="utf-8">
275275
<meta name="viewport" content="width=device-width, initial-scale=1">
276-
<title>Hello from the Google Cloud</title>
276+
<title>Hello from Slalom and Google</title>
277277
<style>
278278
body {
279-
background-color: #000000;
279+
background-color: #0C62FB;
280280
color: #FFFFFF;
281281
font-family: "Lucida Console", "Courier New", monospace;
282282
}

cloudbuild/on-again.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Turn VM back on
22
steps:
3-
- name: cyclenerd/google-cloud-gcp-tools-container:latest
3+
- name: europe-west1-docker.pkg.dev/tor-p-a-nils-snd-soda/cointainer/google-cloud-gcp-tools-container:latest
44
entrypoint: "bash"
55
args:
66
- "-c"

gcp/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Please verify the ownership of the domain (or a parent) at <http://www.google.co
3737
gcloud auth application-default login
3838
```
3939

40+
1. Set quota project
41+
42+
```bash
43+
gcloud auth application-default set-quota-project [EXISTING-GOOGLE-PROJECT]
44+
``````
45+
4046
1. Initialize
4147

4248
```bash

gcp/output-local-files.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ resource "local_file" "variables" {
2020
export MY_PUBSUB_TOPIC_CREATE='${google_pubsub_topic.create.name}'
2121
export MY_DNS_DOMAIN='${google_dns_managed_zone.dns.dns_name}'
2222
export MY_EXPIRES='${var.expires}'
23+
export MY_MAX_VMS='${var.max-vms}'
2324
EOF
2425
filename = "variables.sh"
2526
}

0 commit comments

Comments
 (0)