Skip to content

Commit

Permalink
Update build and deploy tasks for Ubuntu 20.04
Browse files Browse the repository at this point in the history
  • Loading branch information
willaerk committed Nov 20, 2024
1 parent b2ba463 commit 454792c
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 48 deletions.
7 changes: 7 additions & 0 deletions lib/tasks/build.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
desc "Build binaries"
task :build do |task|
system('yarn install') or exit 1
system('yarn build') or exit 1
system('rm -rf node_modules') or exit 1
system('yarn install --production') or exit 1
end
34 changes: 34 additions & 0 deletions lib/tasks/build_artifact.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
desc "Create a debian package from the binaries."
task :build_artifact do |task|

calver_version = ENV['PIPELINE_VERSION'].nil? ? Time.now.strftime("%Y.%m.%d.%H%M%S") : ENV['PIPELINE_VERSION']
git_short_ref = `git rev-parse --short HEAD`.strip
version = ENV['ARTIFACT_VERSION'].nil? ? "#{calver_version}+sha.#{git_short_ref}" : ENV['ARTIFACT_VERSION']
artifact_name = 'uitdatabank-frontend'
vendor = 'publiq VZW'
maintainer = 'Infra publiq <[email protected]>'
license = 'Apache-2.0'
description = 'Frontend for UiTdatabank'
source = 'https://github.com/cultuurnet/udb3-frontend'
build_url = ENV['JOB_DISPLAY_URL'].nil? ? '' : ENV['JOB_DISPLAY_URL']

FileUtils.mkdir_p('pkg')

system('touch .env') or exit 1

system("fpm -s dir -t deb -n #{artifact_name} -v #{version} -a all -p pkg \
-x '.git*' -x pkg -x vendor -x lib -x Rakefile -x Gemfile -x Gemfile.lock \
-x .bundle -x 'Jenkinsfile*' \
--prefix /var/www/udb3-frontend \
--config-files /var/www/udb3-frontend/.env \
--deb-systemd lib/tasks/uitdatabank-frontend.service \
--before-remove lib/tasks/prerm \
--deb-user www-data --deb-group www-data \
--description '#{description}' --url '#{source}' --vendor '#{vendor}' \
--license '#{license}' -m '#{maintainer}' \
--deb-field 'Pipeline-Version: #{calver_version}' \
--deb-field 'Git-Ref: #{git_short_ref}' \
--deb-field 'Build-Url: #{build_url}' \
."
) or exit 1
end
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
User=www-data
Group=www-data
PIDFile=/var/run/udb3-frontend.pid
Environment=NEXT_HOST=localhost
PIDFile=/var/run/uitdatabank-frontend.pid
Environment=NEXT_HOST=127.0.0.1
Environment=NEXT_PORT=4000
EnvironmentFile=-/etc/default/udb3-frontend
EnvironmentFile=-/etc/default/uitdatabank-frontend
WorkingDirectory=/var/www/udb3-frontend
ExecStart=/usr/bin/node node_modules/next/dist/bin/next start -H ${NEXT_HOST} -p ${NEXT_PORT}
Restart=on-failure
Expand Down
9 changes: 0 additions & 9 deletions lib/tasks/uitdatabank-frontend/build.rake

This file was deleted.

36 changes: 0 additions & 36 deletions lib/tasks/uitdatabank-frontend/build_artifact.rake

This file was deleted.

0 comments on commit 454792c

Please sign in to comment.