Skip to content
Draft
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
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
- uses: actions/checkout@v2.3.4
- name: Prepare
id: prepare
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo add-apt-repository ppa:canonical-server/server-backports \
&& sudo apt-get update \
&& sudo apt-get -y install qemu-utils qemu-system-x86
&& sudo apt-get -y install qemu-utils qemu-system-x86 p7zip-full wget make curl unzip
- name: Install pinned iPXE roms
run: wget -O/tmp/roms.zip "$IPXE_ROMS" && sudo unzip -o /tmp/roms.zip -d /usr/lib/ipxe/qemu
- name: Build image
Expand All @@ -43,3 +43,13 @@ jobs:
asset_path: ./alpine.qcow2
asset_name: alpine.qcow2
asset_content_type: application/octet-stream
- name: Upload snapshot
id: upload_snapshot
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./snapshot.7z
asset_name: snapshot.7z
asset_content_type: application/octet-stream
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.qcow2
*.7z
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ alpine.qcow2: setup.sh

.PHONY: clean
clean:
rm -f alpine.qcow2
rm -f alpine.qcow2 snapshot.7z
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ In this file, we will go over the structure and organization of this repo, and g

The sudo on that last command isn't needed if your user has the proper permissions. (e.g. is part of the kvm group)

To test your newly-built image, copy alpine.qcow2 from this directory to Server/alpine.qcow2 in an existing Flashpoint installation. Options can be adjusted in Data/services.json if needed.
To test your newly-built image, copy alpine.qcow2 and snapshot.7z from this directory to the Server/ folder in an existing Flashpoint installation. Options can be adjusted in Data/services.json if needed.
10 changes: 8 additions & 2 deletions snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@ while ! curl -sI 'http://127.0.0.1:22500/' >/dev/null; do
done

echo 'apache is ready .. snapshot in 10 seconds' && sleep 10
echo 'savevm quick' | nc -q1 -w5 127.0.0.1 4445 >/dev/null
kill -TERM "$pid"
echo 'migrate "exec:7z a -si -mx=9 -mfb=64 snapshot.7z"' | nc -q1 -w5 127.0.0.1 4445 >/dev/null
while pgrep -c 7z >/dev/null; do
echo 'Compressing snapshot... sleeping for 10 seconds' && sleep 10
done
# Give an extra 10s of wiggle room.
sleep 10
echo 'quit' | nc -q1 -w5 127.0.0.1 4445 >/dev/null
sleep 5