From d5a45ec8377ba69960d033cd60408e9345def7f9 Mon Sep 17 00:00:00 2001 From: Jamil Bou Kheir Date: Wed, 4 Aug 2021 18:11:28 -0700 Subject: [PATCH] Try omnibus build --- .ci/provision/centos_7.sh | 47 ++-------- .ci/provision/centos_8.sh | 44 +++------ .ci/provision/debian_10.sh | 35 ++----- .ci/provision/fedora_33.sh | 41 ++------- .ci/provision/fedora_34.sh | 42 ++------- .ci/provision/ubuntu_18.04.sh | 36 ++------ .ci/provision/ubuntu_20.04.sh | 37 ++------ .github/workflows/ci.yml | 2 +- omnibus/.rubocop.yml => .rubocop.yml | 0 Vagrantfile | 92 ++++--------------- omnibus/config/projects/firezone.rb | 13 ++- omnibus/config/software/compile_release.rb | 40 ++++++++ omnibus/config/software/ncurses.rb | 5 +- omnibus/config/software/nodejs.rb | 62 +++++++++++++ omnibus/config/software/postgresql.rb | 1 - omnibus/config/software/preparation.rb | 3 +- .../{libossp-uuid.rb => wireguard-tools.rb} | 29 ++---- 17 files changed, 211 insertions(+), 318 deletions(-) rename omnibus/.rubocop.yml => .rubocop.yml (100%) create mode 100644 omnibus/config/software/compile_release.rb create mode 100644 omnibus/config/software/nodejs.rb rename omnibus/config/software/{libossp-uuid.rb => wireguard-tools.rb} (50%) diff --git a/.ci/provision/centos_7.sh b/.ci/provision/centos_7.sh index d4cd4bdd5..4f0b287c7 100755 --- a/.ci/provision/centos_7.sh +++ b/.ci/provision/centos_7.sh @@ -23,7 +23,6 @@ sudo yum install -y \ openssl \ net-tools \ systemd \ - postgresql-server \ iptables # Set locale @@ -31,54 +30,26 @@ sudo bash -c 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' sudo localectl set-locale LANG=en_US.UTF-8 -# Set up Postgres -sudo postgresql-setup initdb -# sudo bash -c 'cat < /var/lib/pgsql/data/pg_hba.conf -# local all all peer -# host all all 127.0.0.1/32 md5 -# host all all ::1/128 md5 -# EOT -# ' -sudo systemctl enable postgresql -sudo systemctl restart postgresql - - - # Install WireGuard sudo yum install -y epel-release elrepo-release sudo yum install -y yum-plugin-elrepo -sudo yum install -y kmod-wireguard wireguard-tools +sudo yum install -y kmod-wireguard - - -# Install asdf +# Install asdf ruby git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc echo '. $HOME/.asdf/completions/asdf.bash' >> $HOME/.bashrc . $HOME/.asdf/asdf.sh -asdf plugin-add nodejs -asdf plugin-add erlang -asdf plugin-add elixir +asdf plugin-add ruby cd /vagrant asdf install +# Install omnibus +cd omnibus +gem install bundler +bundle install --binstubs -# Build release -export MIX_ENV=prod -mix local.hex --force -mix local.rebar --force -mix deps.get --only prod -mix deps.compile -npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error -npm run --prefix ./apps/fz_http/assets deploy -cd apps/fz_http && mix phx.digest && cd /vagrant -mix release -tar -zcf $PKG_FILE -C _build/prod/rel/ firezone - -# file=(/tmp/firezone*.tar.gz) -# /tmp/install.sh /tmp/$file -# systemctl start firezone.service -# systemctl status firezone.service -# journalctl -xeu firezone +# Build omnibus package +bin/omnibus build firezone diff --git a/.ci/provision/centos_8.sh b/.ci/provision/centos_8.sh index 9f0381ed3..b5342dc20 100755 --- a/.ci/provision/centos_8.sh +++ b/.ci/provision/centos_8.sh @@ -23,7 +23,6 @@ sudo yum install -y \ openssl \ net-tools \ systemd \ - postgresql-server \ iptables # Set locale @@ -31,47 +30,26 @@ sudo bash -c 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' sudo localectl set-locale LANG=en_US.UTF-8 -# Set up Postgres -sudo postgresql-setup --initdb --unit postgresql -# Fix postgres login -# sudo cat < /var/lib/pgsql/data/pg_hba.conf -# local all all peer -# host all all 127.0.0.1/32 md5 -# host all all ::1/128 md5 -# EOT -sudo systemctl enable postgresql -sudo systemctl restart postgresql - # Install WireGuard sudo yum install -y epel-release elrepo-release -sudo yum install -y kmod-wireguard wireguard-tools +sudo yum install -y kmod-wireguard -# Install asdf + +# Install asdf ruby git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc echo '. $HOME/.asdf/completions/asdf.bash' >> $HOME/.bashrc . $HOME/.asdf/asdf.sh -asdf plugin-add nodejs -asdf plugin-add erlang -asdf plugin-add elixir +asdf plugin-add ruby cd /vagrant asdf install -# Build release -export MIX_ENV=prod -mix local.hex --force -mix local.rebar --force -mix deps.get --only prod -mix deps.compile -npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error -npm run --prefix ./apps/fz_http/assets deploy -cd apps/fz_http && mix phx.digest && cd /vagrant -mix release -tar -zcf $PKG_FILE -C _build/prod/rel/ firezone +# Install omnibus +cd omnibus +gem install bundler +bundle install --binstubs -# file=(/tmp/firezone*.tar.gz) -# /tmp/install.sh /tmp/$file -# systemctl start firezone.service -# systemctl status firezone.service -# journalctl -xeu firezone + +# Build omnibus package +bin/omnibus build firezone diff --git a/.ci/provision/debian_10.sh b/.ci/provision/debian_10.sh index 3976a9892..cf32b6a5d 100755 --- a/.ci/provision/debian_10.sh +++ b/.ci/provision/debian_10.sh @@ -38,18 +38,14 @@ export LANG=en_US.UTF-8 export LANGUAGE=en_US:en export LC_ALL=en_US.UTF-8 -# Set up Postgres -sudo systemctl enable postgresql -sudo systemctl start postgresql # Add Backports repo sudo bash -c 'echo "deb http://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/backports.list' sudo apt-get -q update + # Install WireGuard -sudo apt-get install -y -q \ - wireguard \ - wireguard-tools +sudo apt-get install -y -q wireguard # Install asdf @@ -57,27 +53,16 @@ git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc echo '. $HOME/.asdf/completions/asdf.bash' >> $HOME/.bashrc . $HOME/.asdf/asdf.sh -asdf plugin-add nodejs -asdf plugin-add erlang -asdf plugin-add elixir +asdf plugin-add ruby cd /vagrant asdf install -# Build release -export MIX_ENV=prod -mix local.hex --force -mix local.rebar --force -mix deps.get --only prod -mix deps.compile -npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error -npm run --prefix ./apps/fz_http/assets deploy -cd apps/fz_http && mix phx.digest && cd /vagrant -mix release -tar -zcf $PKG_FILE -C _build/prod/rel/ firezone +# Install omnibus +cd omnibus +gem install bundler +bundle install --binstubs -# file=(/tmp/firezone*.tar.gz) -# /tmp/install.sh /tmp/$file -# systemctl start firezone || true -# systemctl status firezone.service -# journalctl -xeu firezone + +# Build omnibus package +bin/omnibus build firezone diff --git a/.ci/provision/fedora_33.sh b/.ci/provision/fedora_33.sh index 856660a4b..0b7701088 100755 --- a/.ci/provision/fedora_33.sh +++ b/.ci/provision/fedora_33.sh @@ -23,52 +23,27 @@ sudo yum install -y \ openssl \ net-tools \ systemd \ - postgresql-server \ - iptables \ - wireguard-tools + iptables # Set locale sudo bash -c 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' sudo localectl set-locale LANG=en_US.UTF-8 -# Set up Postgres -sudo postgresql-setup --initdb --unit postgresql -# Fix postgres login -# sudo cat < /var/lib/pgsql/data/pg_hba.conf -# local all all peer -# host all all 127.0.0.1/32 md5 -# host all all ::1/128 md5 -# EOT -sudo systemctl enable postgresql -sudo systemctl restart postgresql - # Install asdf git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc echo '. $HOME/.asdf/completions/asdf.bash' >> $HOME/.bashrc . $HOME/.asdf/asdf.sh -asdf plugin-add nodejs -asdf plugin-add erlang -asdf plugin-add elixir +asdf plugin-add ruby cd /vagrant asdf install -# Build release -export MIX_ENV=prod -mix local.hex --force -mix local.rebar --force -mix deps.get --only prod -mix deps.compile -npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error -npm run --prefix ./apps/fz_http/assets deploy -cd apps/fz_http && mix phx.digest && cd /vagrant -mix release -tar -zcf $PKG_FILE -C _build/prod/rel/ firezone +# Install omnibus +cd omnibus +gem install bundler +bundle install --binstubs -# file=(/tmp/firezone*.tar.gz) -# /tmp/install.sh /tmp/$file -# systemctl start firezone.service -# systemctl status firezone.service -# journalctl -xeu firezone +# Build omnibus package +bin/omnibus build firezone diff --git a/.ci/provision/fedora_34.sh b/.ci/provision/fedora_34.sh index b57bc45e2..0b7701088 100755 --- a/.ci/provision/fedora_34.sh +++ b/.ci/provision/fedora_34.sh @@ -23,51 +23,27 @@ sudo yum install -y \ openssl \ net-tools \ systemd \ - postgresql-server \ - iptables \ - wireguard-tools + iptables # Set locale sudo bash -c 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' sudo localectl set-locale LANG=en_US.UTF-8 -# Set up Postgres -sudo postgresql-setup --initdb --unit postgresql -# Fix postgres login -# sudo cat < /var/lib/pgsql/data/pg_hba.conf -# local all all peer -# host all all 127.0.0.1/32 md5 -# host all all ::1/128 md5 -# EOT -sudo systemctl enable postgresql -sudo systemctl restart postgresql - # Install asdf git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc echo '. $HOME/.asdf/completions/asdf.bash' >> $HOME/.bashrc . $HOME/.asdf/asdf.sh -asdf plugin-add nodejs -asdf plugin-add erlang -asdf plugin-add elixir +asdf plugin-add ruby cd /vagrant asdf install -# Build release -export MIX_ENV=prod -mix local.hex --force -mix local.rebar --force -mix deps.get --only prod -mix deps.compile -npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error -npm run --prefix ./apps/fz_http/assets deploy -cd apps/fz_http && mix phx.digest && cd /vagrant -mix release -tar -zcf $PKG_FILE -C _build/prod/rel/ firezone +# Install omnibus +cd omnibus +gem install bundler +bundle install --binstubs -# file=(/tmp/firezone*.tar.gz) -# /tmp/install.sh /tmp/$file -# systemctl start firezone.service -# systemctl status firezone.service -# journalctl -xeu firezone + +# Build omnibus package +bin/omnibus build firezone diff --git a/.ci/provision/ubuntu_18.04.sh b/.ci/provision/ubuntu_18.04.sh index 37fade796..6bbe605e3 100755 --- a/.ci/provision/ubuntu_18.04.sh +++ b/.ci/provision/ubuntu_18.04.sh @@ -28,10 +28,9 @@ sudo apt-get install -y -q \ net-tools \ iptables \ openssl \ - postgresql \ + postgresql systemd \ - wireguard \ - wireguard-tools + wireguard # Set locale sudo sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen @@ -40,37 +39,22 @@ export LANG=en_US.UTF-8 export LANGUAGE=en_US:en export LC_ALL=en_US.UTF-8 -# Set up Postgres -sudo systemctl enable postgresql -sudo systemctl start postgresql - # Install asdf git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc echo '. $HOME/.asdf/completions/asdf.bash' >> $HOME/.bashrc . $HOME/.asdf/asdf.sh -asdf plugin-add nodejs -asdf plugin-add erlang -asdf plugin-add elixir +asdf plugin-add ruby cd /vagrant asdf install -# Build release -export MIX_ENV=prod -mix local.hex --force -mix local.rebar --force -mix deps.get --only prod -mix deps.compile -npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error -npm run --prefix ./apps/fz_http/assets deploy -cd apps/fz_http && mix phx.digest && cd /vagrant -mix release -tar -zcf $PKG_FILE -C _build/prod/rel/ firezone +# Install omnibus +cd omnibus +gem install bundler +bundle install --binstubs -# file=(/tmp/firezone*.tar.gz) -# /tmp/install.sh /tmp/$file -# systemctl start firezone || true -# systemctl status firezone.service -# journalctl -xeu firezone + +# Build omnibus package +bin/omnibus build firezone diff --git a/.ci/provision/ubuntu_20.04.sh b/.ci/provision/ubuntu_20.04.sh index 37fade796..cd7fcff87 100755 --- a/.ci/provision/ubuntu_20.04.sh +++ b/.ci/provision/ubuntu_20.04.sh @@ -28,10 +28,8 @@ sudo apt-get install -y -q \ net-tools \ iptables \ openssl \ - postgresql \ systemd \ - wireguard \ - wireguard-tools + wireguard # Set locale sudo sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen @@ -40,37 +38,22 @@ export LANG=en_US.UTF-8 export LANGUAGE=en_US:en export LC_ALL=en_US.UTF-8 -# Set up Postgres -sudo systemctl enable postgresql -sudo systemctl start postgresql - -# Install asdf +# Install asdf ruby git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc echo '. $HOME/.asdf/completions/asdf.bash' >> $HOME/.bashrc . $HOME/.asdf/asdf.sh -asdf plugin-add nodejs -asdf plugin-add erlang -asdf plugin-add elixir +asdf plugin-add ruby cd /vagrant asdf install -# Build release -export MIX_ENV=prod -mix local.hex --force -mix local.rebar --force -mix deps.get --only prod -mix deps.compile -npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error -npm run --prefix ./apps/fz_http/assets deploy -cd apps/fz_http && mix phx.digest && cd /vagrant -mix release -tar -zcf $PKG_FILE -C _build/prod/rel/ firezone +# Install omnibus +cd omnibus +gem install bundler +bundle install --binstubs -# file=(/tmp/firezone*.tar.gz) -# /tmp/install.sh /tmp/$file -# systemctl start firezone || true -# systemctl status firezone.service -# journalctl -xeu firezone + +# Build omnibus package +bin/omnibus build firezone diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9d598c49..b943b41a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: os: ubuntu_18.04 - port: 8806 os: ubuntu_20.04 - if: github.ref == 'refs/heads/master' + # if: github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v2 - run: vagrant up ${{ matrix.os }} diff --git a/omnibus/.rubocop.yml b/.rubocop.yml similarity index 100% rename from omnibus/.rubocop.yml rename to .rubocop.yml diff --git a/Vagrantfile b/Vagrantfile index 4499a4238..0542a4eae 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,11 +1,11 @@ +# frozen_string_literal: true + # -*- mode: ruby -*- # vi: set ft=ruby : -VERSION="0.2.0-1" - # This Vagrantfile is used for functional testing in the CI pipeline. Vagrant.configure("2") do |config| - if ENV['CI'] + if ENV["CI"] # Github Actions MacOS hosts have 14 GB RAM and 3 CPU cores :-D config.vm.provider "virtualbox" do |virtualbox| virtualbox.cpus = 3 @@ -13,110 +13,54 @@ Vagrant.configure("2") do |config| end end - config.vm.synced_folder '.', '/vagrant' + config.vm.synced_folder ".", "/vagrant" config.vm.define "centos_7" do |centos7| centos7.vm.box = "generic/centos7" centos7.vm.box_url = "http://vagrant.cloudfire.network/centos7.box" - centos7.vm.network "forwarded_port", guest: 8800, host: 8800 - centos7.vm.provision "shell", - path: ".ci/provision/centos_7.sh", - privileged: false, - env: { PKG_FILE: "firezone-#{VERSION}-centos_7.amd64.tar.gz" } - source_file = Dir["_build/firezone*centos_7*.tar.gz"].first - if source_file - centos7.vm.provision "file", source: source_file, destination: "/tmp/" - centos7.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/" - end + centos7.vm.network "forwarded_port", guest: 8800, host: ENV.fetch("PORT", 8800) + centos7.vm.provision "shell", path: ".ci/provision/centos_7.sh", privileged: false end config.vm.define "centos_8" do |centos8| centos8.vm.box = "generic/centos8" centos8.vm.box_url = "http://vagrant.cloudfire.network/centos8.box" - centos8.vm.network "forwarded_port", guest: 8800, host: 8801 - centos8.vm.provision "shell", - path: ".ci/provision/centos_8.sh", - privileged: false, - env: { PKG_FILE: "firezone-#{VERSION}-centos_8.amd64.tar.gz" } - source_file = Dir["_build/firezone*centos_8*.tar.gz"].first - if source_file - centos8.vm.provision "file", source: source_file, destination: "/tmp/" - centos8.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/" - end + centos8.vm.network "forwarded_port", guest: 8800, host: ENV.fetch("PORT", 8801) + centos8.vm.provision "shell", path: ".ci/provision/centos_8.sh", privileged: false end config.vm.define "debian_10" do |debian10| debian10.vm.box = "generic/debian10" debian10.vm.box_url = "http://vagrant.cloudfire.network/debian10.box" - debian10.vm.network "forwarded_port", guest: 8800, host: 8802 - debian10.vm.provision "shell", - path: ".ci/provision/debian_10.sh", - privileged: false, - env: { PKG_FILE: "firezone-#{VERSION}-debian_10.amd64.tar.gz" } - source_file = Dir["_build/firezone*debian_10*.tar.gz"].first - if source_file - debian10.vm.provision "file", source: source_file, destination: "/tmp/" - debian10.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/" - end + debian10.vm.network "forwarded_port", guest: 8800, host: ENV.fetch("PORT", 8802) + debian10.vm.provision "shell", path: ".ci/provision/debian_10.sh", privileged: false end config.vm.define "fedora_33" do |fedora33| fedora33.vm.box = "generic/fedora33" fedora33.vm.box_url = "http://vagrant.cloudfire.network/fedora33.box" - fedora33.vm.network "forwarded_port", guest: 8800, host: 8803 - fedora33.vm.provision "shell", - path: ".ci/provision/fedora_33.sh", - privileged: false, - env: { PKG_FILE: "firezone-#{VERSION}-fedora_33.amd64.tar.gz" } - source_file = Dir["_build/firezone*fedora_33*.tar.gz"].first - if source_file - fedora33.vm.provision "file", source: source_file, destination: "/tmp/" - fedora33.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/" - end + fedora33.vm.network "forwarded_port", guest: 8800, host: ENV.fetch("PORT", 8803) + fedora33.vm.provision "shell", path: ".ci/provision/fedora_33.sh", privileged: false end config.vm.define "fedora_34" do |fedora34| fedora34.vm.box = "generic/fedora34" fedora34.vm.box_url = "http://vagrant.cloudfire.network/fedora34.box" - fedora34.vm.network "forwarded_port", guest: 8800, host: 8804 - fedora34.vm.provision "shell", - path: ".ci/provision/fedora_34.sh", - privileged: false, - env: { PKG_FILE: "firezone-#{VERSION}-fedora_34.amd64.tar.gz" } - source_file = Dir["_build/firezone*fedora_34*.tar.gz"].first - if source_file - fedora34.vm.provision "file", source: source_file, destination: "/tmp/" - fedora34.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/" - end + fedora34.vm.network "forwarded_port", guest: 8800, host: ENV.fetch("PORT", 8804) + fedora34.vm.provision "shell", path: ".ci/provision/fedora_34.sh", privileged: false end config.vm.define "ubuntu_18.04" do |ubuntu1804| ubuntu1804.vm.box = "generic/ubuntu1804" ubuntu1804.vm.box_url = "http://vagrant.cloudfire.network/ubuntu1804.box" - ubuntu1804.vm.network "forwarded_port", guest: 8800, host: 8805 - ubuntu1804.vm.provision "shell", - path: ".ci/provision/ubuntu_18.04.sh", - privileged: false, - env: { PKG_FILE: "firezone-#{VERSION}-ubuntu_18.04.amd64.tar.gz" } - source_file = Dir["_build/firezone*ubuntu_18.04*.tar.gz"].first - if source_file - ubuntu1804.vm.provision "file", source: source_file, destination: "/tmp/" - ubuntu1804.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/" - end + ubuntu1804.vm.network "forwarded_port", guest: 8800, host: ENV.fetch("PORT", 8805) + ubuntu1804.vm.provision "shell", path: ".ci/provision/ubuntu_18.04.sh", privileged: false end config.vm.define "ubuntu_20.04" do |ubuntu2004| ubuntu2004.vm.box = "generic/ubuntu2004" ubuntu2004.vm.box_url = "http://vagrant.cloudfire.network/ubuntu2004.box" - ubuntu2004.vm.network "forwarded_port", guest: 8800, host: 8806 - ubuntu2004.vm.provision "shell", - path: ".ci/provision/ubuntu_20.04.sh", - privileged: false, - env: { PKG_FILE: "firezone-#{VERSION}-ubuntu_20.04.amd64.tar.gz" } - source_file = Dir["_build/firezone*ubuntu_20.04*.tar.gz"].first - if source_file - ubuntu2004.vm.provision "file", source: source_file, destination: "/tmp/" - ubuntu2004.vm.provision "file", source: "scripts/install.sh", destination: "/tmp/" - end + ubuntu2004.vm.network "forwarded_port", guest: 8800, host: ENV.fetch("PORT", 8806) + ubuntu2004.vm.provision "shell", path: ".ci/provision/ubuntu_20.04.sh", privileged: false end end diff --git a/omnibus/config/projects/firezone.rb b/omnibus/config/projects/firezone.rb index d8da81d16..0d8b8436b 100644 --- a/omnibus/config/projects/firezone.rb +++ b/omnibus/config/projects/firezone.rb @@ -18,6 +18,7 @@ name "firezone" maintainer "FireZone" homepage "https://firez.one" +license "Apache-2.0" # Defaults to C:/firezone on Windows # and /opt/firezone on all other platforms @@ -27,13 +28,19 @@ build_version Omnibus::BuildVersion.semver build_iteration 1 # Creates required build directories -dependency "preparation" +# dependency "preparation" -# firezone dependencies/components -dependency "postgresql" +# firezone build dependencies/components +dependency "compile_release" dependency "erlang" dependency "elixir" +dependency "nodejs" dependency "openssl" +dependency "wireguard-tools" + +# firezone runtime dependencies +runtime_dependency "postgresql" +runtime_dependency "openssl" exclude "**/.git" exclude "**/bundler/git" diff --git a/omnibus/config/software/compile_release.rb b/omnibus/config/software/compile_release.rb new file mode 100644 index 000000000..ea7456b94 --- /dev/null +++ b/omnibus/config/software/compile_release.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Copyright 2021 FireZone +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name "compile_release" +description "the steps required to compile the firezone elixir application" +default_version "1.0.0" + +dependency "elixir" +dependency "nodejs" + +source path: File.expand_path("../", Omnibus::Config.project_root) + +license :project_license +skip_transitive_dependency_licensing true + +build do + command "mix local.hex --force" + command "mix local.rebar --force" + command "mix deps.get --only prod" + command "mix deps.compile --only prod" + command "npm ci --prefix apps/fz_http/assets --progress=false --no-audit --loglevel=error" + command "npm run --prefix apps/fz_http/assets deploy" + command "cd apps/fz_http && mix phx.digest", env: { "MIX_ENV": "prod" } + command "mix release", env: { "MIX_ENV": "prod" } + move "_build/prod/rel/firezone", "#{install_dir}/embedded/firezone" +end diff --git a/omnibus/config/software/ncurses.rb b/omnibus/config/software/ncurses.rb index ca8764f1d..8f6e98b0d 100644 --- a/omnibus/config/software/ncurses.rb +++ b/omnibus/config/software/ncurses.rb @@ -1,4 +1,5 @@ -# +# frozen_string_literal: true + # Copyright 2012-2019, Chef Software Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -106,7 +107,7 @@ build do "--without-ada", "--without-cxx-binding", "--without-debug", - "--without-manpages", + "--without-manpages" ] if aix? diff --git a/omnibus/config/software/nodejs.rb b/omnibus/config/software/nodejs.rb new file mode 100644 index 000000000..8b7c1561b --- /dev/null +++ b/omnibus/config/software/nodejs.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +# Copyright:: Chef Software, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name "nodejs" + +license "MIT" +license_file "LICENSE" +skip_transitive_dependency_licensing true + +default_version "16.6.1" + +# dependency "python" + +default_src_url = "https://nodejs.org/dist/v#{version}/node-v#{version}.tar.gz" + +version "16.6.1" do + source url: default_src_url, sha256: "36467b8a4e7e3bacc2f4f1709a83b0506429d1999bc461e5e363bc91d3437c09" +end + +version "12.22.3" do + source url: default_src_url, sha256: "30acec454f26a168afe6d1c55307c5186ef23dba66527cc34e4497d01f91bda4" +end + +version "0.10.48" do + source url: default_src_url, sha256: "27a1765b86bf4ec9833e2f89e8421ba4bc01a326b883f125de2f0b3494bd5549" +end + +relative_path "node-v#{version}" + +build do + env = with_standard_compiler_flags(with_embedded_path) + + config_command = [ + "--prefix=#{install_dir}/embedded", + "--without-dtrace" + ] + + if version.satisfies?(">= 12") + config_command << "--without-node-snapshot" + config_command << "--without-inspector" + config_command << "--without-intl" + end + + configure(*config_command, env: env) + + make "-j #{workers}", env: env + make "install", env: env +end diff --git a/omnibus/config/software/postgresql.rb b/omnibus/config/software/postgresql.rb index b8e9527ed..d610feefb 100644 --- a/omnibus/config/software/postgresql.rb +++ b/omnibus/config/software/postgresql.rb @@ -26,7 +26,6 @@ dependency "zlib" dependency "openssl" dependency "libedit" dependency "ncurses" -dependency "libossp-uuid" dependency "config_guess" # version_list: url=https://ftp.postgresql.org/pub/source/v#{version}/ filter=*.tar.bz2 diff --git a/omnibus/config/software/preparation.rb b/omnibus/config/software/preparation.rb index 42488ff0e..b45d8a241 100644 --- a/omnibus/config/software/preparation.rb +++ b/omnibus/config/software/preparation.rb @@ -1,4 +1,5 @@ -# +# frozen_string_literal: true + # Copyright 2021 FireZone # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/omnibus/config/software/libossp-uuid.rb b/omnibus/config/software/wireguard-tools.rb similarity index 50% rename from omnibus/config/software/libossp-uuid.rb rename to omnibus/config/software/wireguard-tools.rb index ba4adb157..e2e3b04df 100644 --- a/omnibus/config/software/libossp-uuid.rb +++ b/omnibus/config/software/wireguard-tools.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2012-2014 Chef Software, Inc. +# Copyright 2021 FireZone # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,32 +15,19 @@ # limitations under the License. # -name "libossp-uuid" -default_version "1.6.2" +name "wireguard-tools" +description "wireguard userspace utilities" +default_version "1.0.20210424" -license "MIT" -license_file "README" -skip_transitive_dependency_licensing true +default_src_url = "https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-#{version}.zip" -dependency "config_guess" - -# version_list: url=https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/ filter=*.tar.gz - -version("1.6.2") { source sha256: "11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0" } - -# ftp on ftp.ossp.org is unavaiable so we must use another mirror site. -source url: "https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-#{version}.tar.gz" - -relative_path "uuid-#{version}" +version "1.0.20210424" do + source url: default_src_url, sha256: "1ad170ded2d66d7c5a02fc2fd5ac3e195ec1c98133986f2d8223ed5a72c8877f" +end build do env = with_standard_compiler_flags(with_embedded_path) - update_config_guess - - command "./configure" \ - " --prefix=#{install_dir}/embedded", env: env - make "-j #{workers}", env: env make "install", env: env end