mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
use installation script for install
This commit is contained in:
@@ -1,86 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
version=0.2.0-1
|
||||
base_image="ghcr.io/firezone/${MATRIX_IMAGE}"
|
||||
tag="ghcr.io/firezone/release-${MATRIX_IMAGE/:/_}"
|
||||
pkg_file="firezone-${version}-${MATRIX_IMAGE/:/_}.amd64.tar.gz"
|
||||
image="firezone-${version}-${MATRIX_IMAGE/:/_}:${GITHUB_SHA}"
|
||||
|
||||
case $MATRIX_IMAGE in
|
||||
centos*)
|
||||
format="rpm"
|
||||
;;
|
||||
fedora*)
|
||||
format="rpm"
|
||||
;;
|
||||
debian*)
|
||||
format="deb"
|
||||
;;
|
||||
ubuntu*)
|
||||
format="deb"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Build intermediate release image
|
||||
docker buildx build \
|
||||
--no-cache \
|
||||
--pull \
|
||||
--push \
|
||||
docker build \
|
||||
-t $image \
|
||||
-f pkg/Dockerfile.release \
|
||||
-t $tag \
|
||||
--platform linux/amd64 \
|
||||
--build-arg PKG_FILE=$pkg_file \
|
||||
--build-arg BASE_IMAGE=$base_image \
|
||||
--progress plain \
|
||||
.
|
||||
|
||||
|
||||
|
||||
case $format in
|
||||
deb)
|
||||
version=0.2.0-1
|
||||
pkg_dir="${MATRIX_IMAGE/:/_}.amd64"
|
||||
pkg_file="${pkg_dir}.deb"
|
||||
final_pkg_file="firezone-${version}-${pkg_file}"
|
||||
image="ghcr.io/firezone/package-${MATRIX_IMAGE/:/_}"
|
||||
|
||||
docker buildx build \
|
||||
--push \
|
||||
--pull \
|
||||
--no-cache \
|
||||
-t $image \
|
||||
-f pkg/Dockerfile.deb \
|
||||
--platform linux/amd64 \
|
||||
--build-arg PKG_DIR=$pkg_dir \
|
||||
--build-arg BASE_IMAGE=$tag \
|
||||
--progress plain \
|
||||
.
|
||||
|
||||
cid=$(docker create $image)
|
||||
mkdir -p _build
|
||||
docker cp $cid:/root/$pkg_file ./_build/$final_pkg_file
|
||||
;;
|
||||
|
||||
rpm)
|
||||
version=0.2.0-1
|
||||
pkg_dir="firezone-${version}.x86_64"
|
||||
pkg_file="${pkg_dir}.rpm"
|
||||
os_dir="${MATRIX_IMAGE/:/_}.x86_64"
|
||||
final_pkg_file="firezone-${version}-${MATRIX_IMAGE/:/_}.x86_64.rpm"
|
||||
image="ghcr.io/firezone/package-${MATRIX_IMAGE/:/_}"
|
||||
|
||||
docker buildx build \
|
||||
--push \
|
||||
--pull \
|
||||
--no-cache \
|
||||
-t $image \
|
||||
-f pkg/Dockerfile.rpm \
|
||||
--platform linux/amd64 \
|
||||
--build-arg PKG_DIR=$pkg_dir \
|
||||
--build-arg OS_DIR=$os_dir \
|
||||
--build-arg BASE_IMAGE=$tag \
|
||||
--progress plain \
|
||||
.
|
||||
|
||||
cid=$(docker create $image)
|
||||
mkdir -p _build
|
||||
docker cp $cid:/root/rpmbuild/RPMS/x86_64/$pkg_file ./_build/$final_pkg_file
|
||||
;;
|
||||
esac
|
||||
cid=$(docker create $image)
|
||||
mkdir -p _build
|
||||
docker cp $cid:/root/$pkg_file ./_build/$pkg_file
|
||||
|
||||
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -64,6 +64,14 @@ jobs:
|
||||
- name: Run Tests and Upload Coverage Report
|
||||
run: mix coveralls.github --umbrella
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
build:
|
||||
needs: unit-integration-test
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -98,8 +106,12 @@ jobs:
|
||||
with:
|
||||
name: firezone
|
||||
path: |
|
||||
_build/firezone*.rpm
|
||||
_build/firezone*.deb
|
||||
_build/firezone*.tar.gz
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
functional-test:
|
||||
needs: build
|
||||
@@ -132,6 +144,11 @@ jobs:
|
||||
- run: vagrant up ${{ matrix.os }}
|
||||
- run: .ci/functional_test.sh
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
publish:
|
||||
needs: functional-test
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -165,8 +182,7 @@ jobs:
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
_build/firezone*.deb
|
||||
_build/firezone*.rpm
|
||||
_build/firezone*.tar.gz
|
||||
# - name: Upload Release Asset
|
||||
# id: upload-release-asset
|
||||
# uses: actions/upload-release-asset@v1
|
||||
|
||||
21
Vagrantfile
vendored
21
Vagrantfile
vendored
@@ -7,70 +7,77 @@ Vagrant.configure('2') do |config|
|
||||
config.vm.define "centos_7" do |centos7|
|
||||
centos7.vm.box = "generic/centos7"
|
||||
centos7.vm.network "forwarded_port", guest: 8800, host: 8800
|
||||
source_file = Dir["_build/firezone*centos_7*.rpm"].first
|
||||
source_file = Dir["_build/firezone*centos_7*.tar.gz"].first
|
||||
if source_file
|
||||
centos7.vm.provision "file", source: source_file, destination: "/tmp/"
|
||||
end
|
||||
centos7.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/"
|
||||
centos7.vm.provision "shell", path: "scripts/provision/centos_7.sh"
|
||||
end
|
||||
|
||||
config.vm.define "centos_8" do |centos8|
|
||||
centos8.vm.box = "generic/centos8"
|
||||
centos8.vm.network "forwarded_port", guest: 8800, host: 8801
|
||||
source_file = Dir["_build/firezone*centos_8*.rpm"].first
|
||||
source_file = Dir["_build/firezone*centos_8*.tar.gz"].first
|
||||
if source_file
|
||||
centos8.vm.provision "file", source: source_file, destination: "/tmp/"
|
||||
end
|
||||
centos8.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/"
|
||||
centos8.vm.provision "shell", path: "scripts/provision/centos_8.sh"
|
||||
end
|
||||
|
||||
config.vm.define "debian_10" do |debian10|
|
||||
debian10.vm.box = "generic/debian10"
|
||||
debian10.vm.network "forwarded_port", guest: 8800, host: 8802
|
||||
source_file = Dir["_build/firezone*debian_10*.deb"].first
|
||||
source_file = Dir["_build/firezone*debian_10*.tar.gz"].first
|
||||
if source_file
|
||||
debian10.vm.provision "file", source: source_file, destination: "/tmp/"
|
||||
end
|
||||
debian10.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/"
|
||||
debian10.vm.provision "shell", path: "scripts/provision/debian_10.sh"
|
||||
end
|
||||
|
||||
config.vm.define "fedora_33" do |fedora33|
|
||||
fedora33.vm.box = "generic/fedora33"
|
||||
fedora33.vm.network "forwarded_port", guest: 8800, host: 8803
|
||||
source_file = Dir["_build/firezone*fedora_33*.rpm"].first
|
||||
source_file = Dir["_build/firezone*fedora_33*.tar.gz"].first
|
||||
if source_file
|
||||
fedora33.vm.provision "file", source: source_file, destination: "/tmp/"
|
||||
end
|
||||
fedora33.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/"
|
||||
fedora33.vm.provision "shell", path: "scripts/provision/fedora_33.sh"
|
||||
end
|
||||
|
||||
config.vm.define "fedora_34" do |fedora34|
|
||||
fedora34.vm.box = "generic/fedora34"
|
||||
fedora34.vm.network "forwarded_port", guest: 8800, host: 8804
|
||||
source_file = Dir["_build/firezone*fedora_34*.rpm"].first
|
||||
source_file = Dir["_build/firezone*fedora_34*.tar.gz"].first
|
||||
if source_file
|
||||
fedora34.vm.provision "file", source: source_file, destination: "/tmp/"
|
||||
end
|
||||
fedora34.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/"
|
||||
fedora34.vm.provision "shell", path: "scripts/provision/fedora_34.sh"
|
||||
end
|
||||
|
||||
config.vm.define "ubuntu_18.04" do |ubuntu1804|
|
||||
ubuntu1804.vm.box = "generic/ubuntu1804"
|
||||
ubuntu1804.vm.network "forwarded_port", guest: 8800, host: 8805
|
||||
source_file = Dir["_build/firezone*ubuntu_18.04*.deb"].first
|
||||
source_file = Dir["_build/firezone*ubuntu_18.04*.tar.gz"].first
|
||||
if source_file
|
||||
ubuntu1804.vm.provision "file", source: source_file, destination: "/tmp/"
|
||||
end
|
||||
ubuntu1804.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/"
|
||||
ubuntu1804.vm.provision "shell", path: "scripts/provision/ubuntu_18.04.sh"
|
||||
end
|
||||
|
||||
config.vm.define "ubuntu_20.04" do |ubuntu2004|
|
||||
ubuntu2004.vm.box = "generic/ubuntu2004"
|
||||
ubuntu2004.vm.network "forwarded_port", guest: 8800, host: 8806
|
||||
source_file = Dir["_build/firezone*ubuntu_20.04*.deb"].first
|
||||
source_file = Dir["_build/firezone*ubuntu_20.04*.tar.gz"].first
|
||||
if source_file
|
||||
ubuntu2004.vm.provision "file", source: source_file, destination: "/tmp/"
|
||||
end
|
||||
ubuntu2004.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/"
|
||||
ubuntu2004.vm.provision "shell", path: "scripts/provision/ubuntu_20.04.sh"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
ARG BASE_IMAGE
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
ARG PKG_FILE
|
||||
|
||||
ENV MIX_ENV prod
|
||||
|
||||
# Dockerfile-friendly build release
|
||||
@@ -25,3 +27,5 @@ COPY rel rel
|
||||
COPY config config
|
||||
COPY apps apps
|
||||
RUN mix release
|
||||
|
||||
RUN tar -zcf $PKG_FILE -C _build/prod/rel/ firezone
|
||||
|
||||
40
scripts/install.sh
Executable file
40
scripts/install.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
os_not_found () {
|
||||
echo "Operating System not detected. Build from source?"
|
||||
exit 1
|
||||
}
|
||||
|
||||
download_release () {
|
||||
regex="Operating System: (\w+) ([\d\.]+)"
|
||||
os=`hostnamectl`
|
||||
if [[ $os =~ $regex ]]; then
|
||||
distro="${BASH_REMATCH[1]}"
|
||||
version="${BASH_REMATCH[2]}"
|
||||
if [[ -z $distro ]] && [[ -z $version ]]; then
|
||||
os_not_found
|
||||
else
|
||||
echo "Fetching latest release..."
|
||||
file="firezone-latest-${distro}_${version}.amd64.tar.gz"
|
||||
curl -L -O "https://github.com/firezone/firezone/releases/${file}"
|
||||
fi
|
||||
else
|
||||
os_not_found
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Installing FireZone..."
|
||||
echo
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
echo "Package tarball supplied. Skipping download..."
|
||||
file=$1
|
||||
else
|
||||
download_release
|
||||
fi
|
||||
|
||||
echo "Extracting package to /opt/firezone..."
|
||||
tar -zxf $file -C /opt/
|
||||
|
||||
echo "FireZone installed!"
|
||||
@@ -23,7 +23,10 @@ yum install -y epel-release elrepo-release
|
||||
yum install -y yum-plugin-elrepo
|
||||
yum install -y kmod-wireguard wireguard-tools
|
||||
|
||||
rpm -ivh /tmp/firezone*.rpm
|
||||
systemctl start firezone.service
|
||||
systemctl status firezone.service
|
||||
journalctl -xeu firezone
|
||||
|
||||
file=(/tmp/firezone*.tar.gz)
|
||||
/tmp/install.sh /tmp/$file
|
||||
|
||||
# systemctl start firezone.service
|
||||
# systemctl status firezone.service
|
||||
# journalctl -xeu firezone
|
||||
|
||||
@@ -22,7 +22,11 @@ systemctl restart postgresql
|
||||
yum install -y epel-release elrepo-release
|
||||
yum install -y kmod-wireguard wireguard-tools
|
||||
|
||||
rpm -ivh /tmp/firezone*.rpm
|
||||
systemctl start firezone.service
|
||||
systemctl status firezone.service
|
||||
journalctl -xeu firezone
|
||||
|
||||
file=(/tmp/firezone*.tar.gz)
|
||||
/tmp/install.sh /tmp/$file
|
||||
|
||||
|
||||
# systemctl start firezone.service
|
||||
# systemctl status firezone.service
|
||||
# journalctl -xeu firezone
|
||||
|
||||
@@ -22,7 +22,13 @@ apt-get install -y -q \
|
||||
wireguard \
|
||||
wireguard-tools
|
||||
|
||||
dpkg --debug=2003 -i /tmp/firezone*.deb
|
||||
systemctl start firezone || true
|
||||
systemctl status firezone.service
|
||||
journalctl -xeu firezone
|
||||
file=(/tmp/firezone*.tar.gz)
|
||||
/tmp/install.sh /tmp/$file
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# systemctl start firezone || true
|
||||
# systemctl status firezone.service
|
||||
# journalctl -xeu firezone
|
||||
|
||||
@@ -19,7 +19,11 @@ EOT
|
||||
systemctl enable postgresql
|
||||
systemctl restart postgresql
|
||||
|
||||
rpm -ivh /tmp/firezone*.rpm
|
||||
systemctl start firezone.service
|
||||
systemctl status firezone.service
|
||||
journalctl -xeu firezone
|
||||
file=(/tmp/firezone*.tar.gz)
|
||||
/tmp/install.sh /tmp/$file
|
||||
|
||||
|
||||
|
||||
# systemctl start firezone.service
|
||||
# systemctl status firezone.service
|
||||
# journalctl -xeu firezone
|
||||
|
||||
@@ -19,7 +19,9 @@ EOT
|
||||
systemctl enable postgresql
|
||||
systemctl restart postgresql
|
||||
|
||||
rpm -ivh /tmp/firezone*.rpm
|
||||
systemctl start firezone.service
|
||||
systemctl status firezone.service
|
||||
journalctl -xeu firezone
|
||||
file=(/tmp/firezone*.tar.gz)
|
||||
/tmp/install.sh /tmp/$file
|
||||
|
||||
# systemctl start firezone.service
|
||||
# systemctl status firezone.service
|
||||
# journalctl -xeu firezone
|
||||
|
||||
@@ -14,7 +14,9 @@ apt-get install -y -q \
|
||||
systemctl enable postgresql
|
||||
systemctl start postgresql
|
||||
|
||||
dpkg -i /tmp/firezone*.deb
|
||||
systemctl start firezone
|
||||
systemctl status firezone.service
|
||||
journalctl -xeu firezone
|
||||
file=(/tmp/firezone*.tar.gz)
|
||||
/tmp/install.sh /tmp/$file
|
||||
|
||||
# systemctl start firezone
|
||||
# systemctl status firezone.service
|
||||
# journalctl -xeu firezone
|
||||
|
||||
@@ -14,7 +14,11 @@ apt-get install -y -q \
|
||||
systemctl enable postgresql
|
||||
systemctl start postgresql
|
||||
|
||||
dpkg -i /tmp/firezone*.deb
|
||||
systemctl start firezone
|
||||
systemctl status firezone.service
|
||||
journalctl -xeu firezone
|
||||
file=(/tmp/firezone*.tar.gz)
|
||||
/tmp/install.sh /tmp/$file
|
||||
|
||||
|
||||
|
||||
# systemctl start firezone
|
||||
# systemctl status firezone.service
|
||||
# journalctl -xeu firezone
|
||||
|
||||
Reference in New Issue
Block a user