Checkpoint before move to Omnibus

This commit is contained in:
Jamil Bou Kheir
2021-08-04 07:39:36 -07:00
parent c57b5165e7
commit 99bd1a795a
2 changed files with 39 additions and 41 deletions

View File

@@ -1,38 +0,0 @@
name: Build base images
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *' # 10am UTC
jobs:
build-and-push:
env:
MATRIX_IMAGE: ${{ matrix.image }}
MATRIX_PLATFORM: ${{ matrix.platform }}
strategy:
matrix:
image:
- centos:7
- centos:8
- fedora:33
- fedora:34
- debian:10
- ubuntu:18.04
- ubuntu:20.04
platform:
- linux/amd64
runs-on: ubuntu-20.04
steps:
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- run: |
# Required due to a buildx bug.
# See https://github.com/docker/buildx/issues/495#issuecomment-761562905
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap
.ci/build_base.sh

View File

@@ -34,7 +34,43 @@ else
download_release
fi
echo "Extracting package to /opt/firezone..."
tar -zxf $file -C /opt/
echo "Setting up FireZone..."
echo
echo "FireZone installed!"
if id firezone &>/dev/null; then
echo "firezone user exists... not creating."
else
echo "Creating system user firezone"
useradd --system firezone
fi
echo "Extracting package to /opt/firezone..."
echo
tar -zxf $file -C /opt/
chmod -R firezone:firezone /opt/firezone
# Create DB user
echo "Creating DB user..."
hostname=$(hostname)
db_user=firezone
db_password="$(openssl rand -hex 16)"
res=$(su postgres -c "psql -c \"SELECT 1 FROM pg_roles WHERE rolname = '${db_user}';\"")
if [[ $res == *"0 rows"* ]]; then
su postgres -c "psql -c \"CREATE ROLE ${db_user} WITH LOGIN PASSWORD '${db_password}';\""
else
echo "${db_user} role found in DB"
fi
# Create DB if not exists
db_name=firezone
res=$(su postgres -c "psql -c \"SELECT 1 FROM pg_database WHERE datname = '${db_name}';\"")
if [[ $res == *"0 rows"* ]]; then
su postgres -c "psql -c \"CREATE DATABASE firezone;\" || true"
else
echo "${db_name} exists; not creating"
fi
echo "FireZone installed successfully!"