Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Goal
<!-- What does this PR accomplish? 1 sentence. -->

## Changes
-

## Testing
<!-- How did you verify it? -->

## Checklist
- [ ] Title is a clear sentence (≤ 70 chars)
- [ ] Commits are signed (`git log --show-signature`)
- [ ] `submissions/labN.md` updated
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ Thumbs.db
# *.sbom.cdx.json, zap-*.html/json, trivy-*.txt (Lab 9 scan evidence)
# flake.nix, flake.lock (Lab 11)
# wasm/main.go, spin.toml, go.sum (Lab 12)
data/
app/data/
.vagrant/
27 changes: 27 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-24.04"
config.vm.hostname = "quicknotes-vm"

config.vm.network "forwarded_port",
guest: 8080,
host: 18080,
host_ip: "127.0.0.1"

config.vm.synced_folder "./app", "/opt/quicknotes"

config.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 1024
end

config.vm.provision "shell", inline: <<-SHELL
set -eux
GO_VERSION=1.24.6
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tgz
rm -rf /usr/local/go
tar -C /usr/local -xzf /tmp/go.tgz
echo 'export PATH=$PATH:/usr/local/go/bin' > /etc/profile.d/go.sh
chmod +x /etc/profile.d/go.sh
/usr/local/go/bin/go version
SHELL
end
24 changes: 24 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# syntax=docker/dockerfile:1

FROM golang:1.24.6-bookworm AS builder
WORKDIR /src
COPY go.mod go.su[m] ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build \
-trimpath \
-ldflags='-s -w' \
-o /out/quicknotes .
RUN mkdir -p /data-empty

FROM busybox:1.37-uclibc AS busybox

FROM gcr.io/distroless/static:nonroot
WORKDIR /app
COPY --from=builder /out/quicknotes /app/quicknotes
COPY --from=builder /src/seed.json /app/seed.json
COPY --from=busybox /bin/wget /bin/wget
COPY --from=builder --chown=65532:65532 /data-empty /data
USER nonroot:nonroot
EXPOSE 8080
ENTRYPOINT ["/app/quicknotes"]
29 changes: 29 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
services:
quicknotes:
build: ./app
image: quicknotes:lab6
ports:
- "8080:8080"
environment:
ADDR: ":8080"
DATA_PATH: /data/notes.json
SEED_PATH: /app/seed.json
healthcheck:
test: ["CMD", "/bin/wget", "-q", "-O", "-", "http://127.0.0.1:8080/health"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
cap_drop:
- ALL
read_only: true
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
volumes:
- quicknotes-data:/data
restart: unless-stopped

volumes:
quicknotes-data:
23 changes: 23 additions & 0 deletions evidence/lab5/01-task1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
=== vagrant up (first 12 lines) ===
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/ubuntu-24.04' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'bento/ubuntu-24.04'
default: URL: https://vagrantcloud.com/api/v2/vagrant/bento/ubuntu-24.04
==> default: Adding box 'bento/ubuntu-24.04' (v202510.26.0) for provider: virtualbox (amd64)
default: Downloading: https://vagrantcloud.com/bento/boxes/ubuntu-24.04/versions/202510.26.0/providers/virtualbox/amd64/vagrant.box
Progress: 0% (Rate: 0/s, Estimated time remaining: --:--:--)Progress: 0% (Rate: 0*/s, Estimated time remaining: --:--:--)Progress: 0% (Rate: 0*/s, Estimated time remaining: --:--:--)Progress: 100% (Rate: 0/s, Estimated time remaining: --:--:--)Progress: 100% (Rate: 0/s, Estimated time remaining: --:--:--)Progress: 0% (Rate: 0*/s, Estimated time remaining: --:--:--)Progress: 0% (Rate: 0*/s, Estimated time remaining: --:--:--)Progress: 0% (Rate: 0*/s, Estimated time remaining: --:--:--)Progress: 0% (Rate: 0</s, Estimated time remaining: --:--:--)Progress: 0% (Rate: 417k/s, Estimated time remaining: 1:34:14)Progress: 2% (Rate: 4262k/s, Estimated time remaining: 0:07:06)Progress: 4% (Rate: 7272k/s, Estimated time remaining: 0:03:22)Progress: 6% (Rate: 8855k/s, Estimated time remaining: 0:02:25)Progress: 9% (Rate: 11.8M/s, Estimated time remaining: 0:01:53)Progress: 12% (Rate: 14.9M/s, Estimated time remaining: 0:01:33)Progress: 14% (Rate: 15.3M/s, Estimated time remaining: 0:01:23)Progress: 16% (Rate: 15.3M/s, Estimated time remaining: 0:01:13)Progress: 19% (Rate: 15.5M/s, Estimated time remaining: 0:01:05)Progress: 21% (Rate: 15.3M/s, Estimated time remaining: 0:01:00)Progress: 24% (Rate: 15.5M/s, Estimated time remaining: 0:00:55)Progress: 26% (Rate: 15.3M/s, Estimated time remaining: 0:00:52)Progress: 29% (Rate: 15.3M/s, Estimated time remaining: 0:00:48)Progress: 31% (Rate: 15.0M/s, Estimated time remaining: 0:00:45)Progress: 34% (Rate: 15.2M/s, Estimated time remaining: 0:00:42)Progress: 36% (Rate: 14.9M/s, Estimated time remaining: 0:00:40)Progress: 38% (Rate: 15.1M/s, Estimated time remaining: 0:00:38)Progress: 41% (Rate: 15.1M/s, Estimated time remaining: 0:00:35)Progress: 44% (Rate: 15.5M/s, Estimated time remaining: 0:00:33)Progress: 46% (Rate: 15.1M/s, Estimated time remaining: 0:00:31)Progress: 48% (Rate: 15.1M/s, Estimated time remaining: 0:00:29)Progress: 51% (Rate: 15.3M/s, Estimated time remaining: 0:00:28)Progress: 53% (Rate: 15.1M/s, Estimated time remaining: 0:00:26)Progress: 56% (Rate: 14.7M/s, Estimated time remaining: 0:00:24)Progress: 58% (Rate: 15.1M/s, Estimated time remaining: 0:00:23)Progress: 60% (Rate: 15.1M/s, Estimated time remaining: 0:00:21)Progress: 63% (Rate: 14.9M/s, Estimated time remaining: 0:00:20)Progress: 65% (Rate: 15.1M/s, Estimated time remaining: 0:00:18)Progress: 68% (Rate: 15.1M/s, Estimated time remaining: 0:00:17)Progress: 70% (Rate: 15.3M/s, Estimated time remaining: 0:00:15)Progress: 73% (Rate: 15.2M/s, Estimated time remaining: 0:00:14)Progress: 75% (Rate: 15.2M/s, Estimated time remaining: 0:00:13)Progress: 78% (Rate: 15.2M/s, Estimated time remaining: 0:00:11)Progress: 80% (Rate: 15.2M/s, Estimated time remaining: 0:00:10)Progress: 83% (Rate: 15.1M/s, Estimated time remaining: 0:00:09)Progress: 85% (Rate: 15.2M/s, Estimated time remaining: 0:00:08)Progress: 88% (Rate: 15.2M/s, Estimated time remaining: 0:00:06)Progress: 90% (Rate: 15.4M/s, Estimated time remaining: 0:00:05)Progress: 92% (Rate: 15.3M/s, Estimated time remaining: 0:00:04)Progress: 95% (Rate: 15.2M/s, Estimated time remaining: 0:00:03)Progress: 97% (Rate: 15.3M/s, Estimated time remaining: 0:00:01)==> default: Successfully added box 'bento/ubuntu-24.04' (v202510.26.0) for 'virtualbox (amd64)'!
==> default: Importing base box 'bento/ubuntu-24.04'...
Progress: 20%Progress: 30%Progress: 40%Progress: 90%==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-24.04' version '202510.26.0' is up to date...

=== go version inside VM ===
go version go1.24.6 linux/amd64

=== curl from inside the VM ===
{"notes":4,"status":"ok"}

=== curl from the host via forwarded port 18080 ===
{"notes":4,"status":"ok"}

Expand Down
24 changes: 24 additions & 0 deletions evidence/lab5/02-snapshot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
==> default: Snapshotting the machine as 'clean-go-installed'...
==> default: Snapshot saved! You can restore the snapshot at any time by
==> default: using `vagrant snapshot restore`. You can delete it using
==> default: `vagrant snapshot delete`.
Go removed
bash: line 1: go: command not found
BROKEN: go not found
==> default: Forcing shutdown of VM...
==> default: Restoring the snapshot 'clean-go-installed'...
Progress: 0%Progress: 90%==> default: Checking if box 'bento/ubuntu-24.04' version '202510.26.0' is up to date...
==> default: Resuming suspended VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

real 0m23,639s
user 0m2,052s
sys 0m1,636s
go version go1.24.6 linux/amd64
Expand Down
18 changes: 18 additions & 0 deletions evidence/lab5/03-vm-baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
=== VM: cold boot ===
==> default: flag to force provisioning. Provisioners marked to run always will still run.

real 0m24,846s
user 0m2,504s
sys 0m2,046s

=== VM: idle RAM ===

total used free shared buff/cache available
Mem: 961Mi 319Mi 569Mi 1.0Mi 212Mi 641Mi
Swap: 2.9Gi 0B 2.9Gi

=== VM: process count ===
161

=== VM: disk size ===
2,7G /home/hns/VirtualBox VMs/DevOps-Intro_default_1786039072396_15360
23 changes: 23 additions & 0 deletions evidence/lab5/04-container-baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
=== Container: cold start ===
qn5
qn5

real 0m0,125s
user 0m0,006s
sys 0m0,010s

=== Container: health ===
{"notes":4,"status":"ok"}


=== Container: idle RAM ===
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
74c862bfe5d0 qn5 0.00% 3.207MiB / 15.42GiB 0.02% 530B / 574B 0B / 0B 8

=== Container: process count ===
1

=== Container: image size ===
WARNING: This output is designed for human readability. For machine-readable output, please use --format.
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
quicknotes:lab5 31a7ee277ce2 9.22MB 0B U
Loading