diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b987899..fb0320e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -8,7 +8,7 @@ on: jobs: build-and-push: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 @@ -20,6 +20,9 @@ jobs: - name: Build run: make build + - name: what gblic? + run: ldd --version ldd + - name: Test run: go test ./... diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 95ec095..5ef07bd 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -5,15 +5,21 @@ set -e # Getting permissions errors on local when trying to push? Run this: # gcloud auth configure-docker us-central1-docker.pkg.dev + +# Run on initial instance creation: +# > sudo apt-get update +# > sudo apt-get install podman + make webapp-linux -docker buildx build --platform linux/amd64 --build-arg BIN=bin/linux_amd64/webapp -t us-central1-docker.pkg.dev/ian-rose/docker-1/webapp:latest . +HOST_IP=$(gcloud compute --project ian-rose instances describe instance-1 --zone us-central1-a --format "get(networkInterfaces[0].accessConfigs.natIP)") + +#docker buildx build --platform linux/amd64 --build-arg BIN=bin/linux_amd64/webapp -t us-central1-docker.pkg.dev/ian-rose/docker-1/webapp:latest . #docker build -t us-central1-docker.pkg.dev/ian-rose/docker-1/webapp:latest . -docker push us-central1-docker.pkg.dev/ian-rose/docker-1/webapp:latest +#docker push us-central1-docker.pkg.dev/ian-rose/docker-1/webapp:latest -ssh ianrose14@34.66.56.67 mkdir -p config/ -scp config/* ianrose14@34.66.56.67:config/ -scp scripts/startup.sh ianrose14@34.66.56.67: +gcloud compute --project ian-rose ssh ianrose14@instance-1 --zone us-central1-a -- mkdir -p config/ +gcloud compute --project ian-rose scp --zone us-central1-a config/* ianrose14@instance-1:config/ +gcloud compute --project ian-rose scp --zone us-central1-a scripts/startup.sh ianrose14@instance-1: -#scp bin/linux_amd64/webapp ianrose14@34.66.56.67: -ssh ianrose14@34.66.56.67 bash ./startup.sh +ssh ianrose14@"${HOST_IP}" bash ./startup.sh diff --git a/scripts/startup.sh b/scripts/startup.sh index e11cdde..95bbe9b 100755 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -5,7 +5,11 @@ set -e (podman stop webapp) || true (podman rm webapp) || true -gcloud auth --quiet print-access-token | podman login -u oauth2accesstoken --password-stdin https://us-central1-docker.pkg.dev +mkdir -p data + +# ref 1: https://stackoverflow.com/questions/63790529/authenticate-to-google-container-registry-with-podman +# ref 2: https://github.com/containers/podman/issues/13691#issuecomment-1081913637 +gcloud auth --quiet print-access-token | podman login -u oauth2accesstoken --password-stdin us-central1-docker.pkg.dev podman pull us-central1-docker.pkg.dev/ian-rose/docker-1/webapp:latest podman run -d -p 8080:80 -p 8443:443 --restart=no \ -v "$(pwd)/config":/root/config/ -v "$(pwd)/data":/root/data/ --name webapp \