Extract builder from app
Building is different from running
This commit is contained in:
@@ -2,28 +2,6 @@ require_relative "setup"
|
||||
|
||||
namespace :mrsk do
|
||||
namespace :app do
|
||||
desc "Deliver a newly built app image to servers"
|
||||
task deliver: %i[ push pull ]
|
||||
|
||||
desc "Build locally and push app image to registry"
|
||||
task :push do
|
||||
run_locally do
|
||||
begin
|
||||
info "Building multi-architecture images may take a while (run with VERBOSE=1 for progress logging)"
|
||||
execute *MRSK.app.push
|
||||
rescue SSHKit::Command::Failed => e
|
||||
error "Missing compatible buildx builder, so creating a new one first"
|
||||
execute *MRSK.app.create_new_builder
|
||||
execute *MRSK.app.push
|
||||
end
|
||||
end unless ENV["VERSION"]
|
||||
end
|
||||
|
||||
desc "Pull app image from the registry onto servers"
|
||||
task :pull do
|
||||
on(MRSK.config.hosts) { execute *MRSK.app.pull }
|
||||
end
|
||||
|
||||
desc "Run app on servers (or start them if they've already been run)"
|
||||
task :run do
|
||||
MRSK.config.roles.each do |role|
|
||||
|
||||
27
lib/tasks/mrsk/builder.rake
Normal file
27
lib/tasks/mrsk/builder.rake
Normal file
@@ -0,0 +1,27 @@
|
||||
require_relative "setup"
|
||||
|
||||
namespace :mrsk do
|
||||
namespace :builder do
|
||||
desc "Deliver a newly built app image to servers"
|
||||
task deliver: %i[ push pull ]
|
||||
|
||||
desc "Build locally and push app image to registry"
|
||||
task :push do
|
||||
run_locally do
|
||||
begin
|
||||
info "Building multi-architecture images may take a while (run with VERBOSE=1 for progress logging)"
|
||||
execute *MRSK.builder.push
|
||||
rescue SSHKit::Command::Failed => e
|
||||
error "Missing compatible buildx builder, so creating a new one first"
|
||||
execute *MRSK.builder.create
|
||||
execute *MRSK.builder.push
|
||||
end
|
||||
end unless ENV["VERSION"]
|
||||
end
|
||||
|
||||
desc "Pull app image from the registry onto servers"
|
||||
task :pull do
|
||||
on(MRSK.config.hosts) { execute *MRSK.builder.pull }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2,10 +2,10 @@ require_relative "setup"
|
||||
|
||||
namespace :mrsk do
|
||||
desc "Deploy app for the first time to a fresh server"
|
||||
task fresh: %w[ server:bootstrap registry:login app:deliver traefik:run app:stop app:run ]
|
||||
task fresh: %w[ server:bootstrap registry:login builder:deliver traefik:run app:stop app:run ]
|
||||
|
||||
desc "Push the latest version of the app, ensure Traefik is running, then restart app"
|
||||
task deploy: %w[ registry:login app:deliver traefik:run app:stop app:run prune ]
|
||||
task deploy: %w[ registry:login builder:deliver traefik:run app:stop app:run prune ]
|
||||
|
||||
desc "Rollback to VERSION=x that was already run as a container on servers"
|
||||
task rollback: %w[ app:restart ]
|
||||
|
||||
Reference in New Issue
Block a user