switch from Docker Hub to GCR for private OS image
and cleaned up install.sh a bit
This commit is contained in:
@@ -8,8 +8,8 @@ YOU_ARE_HERE="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|||||||
# container will be useless unless we bundle the actual OS
|
# container will be useless unless we bundle the actual OS
|
||||||
test -f "$YOU_ARE_HERE"/hdd/hdd.img
|
test -f "$YOU_ARE_HERE"/hdd/hdd.img
|
||||||
|
|
||||||
# this image is private on Docker Hub, make sure we're logged in
|
# this image is private on Google Cloud Registry, make sure we're logged in
|
||||||
docker login
|
gcloud auth configure-docker
|
||||||
|
|
||||||
docker build -t jakejarvis/y2k:latest --no-cache "$YOU_ARE_HERE"
|
docker build -t gcr.io/jakejarvis/y2k:latest --no-cache "$YOU_ARE_HERE"
|
||||||
docker push jakejarvis/y2k:latest
|
docker push gcr.io/jakejarvis/y2k:latest
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
# /lib/systemd/system/y2k.service
|
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=y2k websockets
|
Description=WebSockets server
|
||||||
After=network.target
|
After=network.target
|
||||||
StartLimitIntervalSec=0
|
StartLimitIntervalSec=0
|
||||||
|
|
||||||
|
|||||||
+39
-20
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# you probably shouldn't just run this! ;)
|
# WARNING: you probably shouldn't just run this! ;)
|
||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
@@ -12,18 +12,12 @@ apt-get -y --no-install-recommends install \
|
|||||||
ca-certificates \
|
ca-certificates \
|
||||||
gnupg-agent \
|
gnupg-agent \
|
||||||
software-properties-common \
|
software-properties-common \
|
||||||
curl \
|
|
||||||
wget \
|
|
||||||
unzip
|
unzip
|
||||||
|
|
||||||
#### install papertrail logging ####
|
#### install papertrail logging ####
|
||||||
wget -qO - --header="X-Papertrail-Token: CHANGEMECHANGEMECHANGEME" \
|
wget -qO - --header="X-Papertrail-Token: CHANGEMECHANGEMECHANGEME" \
|
||||||
https://papertrailapp.com/destinations/CHANGEME/setup.sh | bash
|
https://papertrailapp.com/destinations/CHANGEME/setup.sh | bash
|
||||||
|
|
||||||
#### docker fixes ####
|
|
||||||
# sed -i 's/\(GRUB_CMDLINE_LINUX="\)"/\1cgroup_enable=memory swapaccount=1"/' /etc/default/grub
|
|
||||||
# update-grub
|
|
||||||
|
|
||||||
#### install Docker from official repository ####
|
#### install Docker from official repository ####
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||||
apt-key fingerprint 0EBFCD88
|
apt-key fingerprint 0EBFCD88
|
||||||
@@ -33,28 +27,53 @@ add-apt-repository \
|
|||||||
stable"
|
stable"
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install docker-ce docker-ce-cli containerd.io
|
apt-get install docker-ce docker-ce-cli containerd.io
|
||||||
|
docker version
|
||||||
|
|
||||||
|
#### docker fixes ####
|
||||||
|
## https://github.com/moby/moby/issues/4250
|
||||||
|
# sed -i 's/\(GRUB_CMDLINE_LINUX="\)"/\1cgroup_enable=memory swapaccount=1"/' /etc/default/grub
|
||||||
|
# update-grub
|
||||||
|
|
||||||
#### install websocketd ####
|
#### install websocketd ####
|
||||||
wget https://github.com/joewalnes/websocketd/releases/download/v0.3.1/websocketd-0.3.1-linux_amd64.zip
|
## https://github.com/joewalnes/websocketd/releases
|
||||||
unzip websocketd-0.3.1-linux_amd64.zip
|
WEBSOCKETD_VERSION=0.3.1
|
||||||
chmod +x websocketd
|
wget -nv -P /tmp/ https://github.com/joewalnes/websocketd/releases/download/v${WEBSOCKETD_VERSION}/websocketd-${WEBSOCKETD_VERSION}-linux_amd64.zip
|
||||||
mv websocketd /usr/bin/
|
unzip /tmp/websocketd-${WEBSOCKETD_VERSION}-linux_amd64.zip websocketd -d /tmp
|
||||||
|
mv /tmp/websocketd /usr/local/bin/
|
||||||
|
chmod +x /usr/local/bin/websocketd
|
||||||
|
rm /tmp/websocketd-${WEBSOCKETD_VERSION}-linux_amd64.zip
|
||||||
|
websocketd --version
|
||||||
|
|
||||||
#### install cloudflared ####
|
#### install cloudflared ####
|
||||||
wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.deb
|
## https://developers.cloudflare.com/argo-tunnel/downloads/
|
||||||
dpkg -i cloudflared-stable-linux-amd64.deb
|
wget -nv -P /tmp/ https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.deb
|
||||||
cloudflared update
|
dpkg -i /tmp/cloudflared-stable-linux-amd64.deb
|
||||||
cloudflared tunnel login
|
rm /tmp/cloudflared-stable-linux-amd64.deb
|
||||||
|
cloudflared version
|
||||||
cloudflared service install
|
cloudflared service install
|
||||||
systemctl enable cloudflared
|
systemctl enable cloudflared
|
||||||
systemctl start cloudflared
|
systemctl start cloudflared
|
||||||
|
|
||||||
#### clone repository ####
|
#### login to cloudflare ####
|
||||||
git clone https://github.com/jakejarvis/y2k.git /root/y2k
|
cloudflared tunnel login
|
||||||
|
|
||||||
#### pull Docker image ####
|
#### install Google Cloud Registry credential helper ####
|
||||||
docker login
|
## https://cloud.google.com/container-registry/docs/advanced-authentication#standalone-helper
|
||||||
docker pull jakejarvis/y2k:latest
|
## https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases
|
||||||
|
GCR_HELPER_VERSION=2.0.1
|
||||||
|
curl -fsSL https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v${GCR_HELPER_VERSION}/docker-credential-gcr_linux_amd64-${GCR_HELPER_VERSION}.tar.gz | tar xz --to-stdout ./docker-credential-gcr > /usr/local/bin/docker-credential-gcr
|
||||||
|
chmod +x /usr/local/bin/docker-credential-gcr
|
||||||
|
docker-credential-gcr version
|
||||||
|
|
||||||
|
#### login to GCR ####
|
||||||
|
docker-credential-gcr gcr-login
|
||||||
|
docker-credential-gcr configure-docker
|
||||||
|
|
||||||
|
#### pull OS container ####
|
||||||
|
docker pull gcr.io/jakejarvis/y2k:latest
|
||||||
|
|
||||||
|
#### clone repository for scripts ####
|
||||||
|
git clone https://github.com/jakejarvis/y2k.git /root/y2k
|
||||||
|
|
||||||
#### enable & start service ####
|
#### enable & start service ####
|
||||||
cp /root/y2k/backend/server/example.service /lib/systemd/system/y2k.service
|
cp /root/y2k/backend/server/example.service /lib/systemd/system/y2k.service
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
/usr/bin/websocketd \
|
/usr/local/bin/websocketd \
|
||||||
--port=80 \
|
--port=80 \
|
||||||
--binary \
|
--binary \
|
||||||
--header-ws="Sec-WebSocket-Protocol: binary" \
|
--header-ws="Sec-WebSocket-Protocol: binary" \
|
||||||
@@ -12,7 +12,8 @@
|
|||||||
--network none \
|
--network none \
|
||||||
--log-driver none \
|
--log-driver none \
|
||||||
--rm -i \
|
--rm -i \
|
||||||
jakejarvis/y2k:latest
|
gcr.io/jakejarvis/y2k:latest
|
||||||
|
|
||||||
# NOTE: if not using Docker, the command is:
|
# to spawn QEMU processes natively on the host machine instead of via
|
||||||
|
# individual Docker containers:
|
||||||
# /root/y2k/backend/bin/boot.rb /root/y2k/backend/hdd /usr/bin/qemu-system-i386
|
# /root/y2k/backend/bin/boot.rb /root/y2k/backend/hdd /usr/bin/qemu-system-i386
|
||||||
|
|||||||
Reference in New Issue
Block a user