Skip to content

Commit

Permalink
add mina for deploying capability
Browse files Browse the repository at this point in the history
  • Loading branch information
snex committed Feb 18, 2023
1 parent dbc64c3 commit 486c2bf
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'

ruby '3.0.4'

group :development, :test do
gem 'mina'
gem 'mina-systemd'
end
23 changes: 23 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
GEM
remote: https://rubygems.org/
specs:
mina (1.0.7)
open4 (~> 1.3.4)
rake
mina-systemd (0.1.1)
mina (~> 1.0.0)
open4 (1.3.4)
rake (13.0.6)

PLATFORMS
x86_64-linux

DEPENDENCIES
mina
mina-systemd

RUBY VERSION
ruby 3.0.4p208

BUNDLED WITH
2.2.33
73 changes: 73 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
require 'mina/git'
require 'mina/systemd'
#
# the deploy tasks are listed here for some reason, so need to require it even though this project is not rails
require 'mina/rails'
# require 'mina/rbenv' # for rbenv support. (https://rbenv.org)
# require 'mina/rvm' # for rvm support. (https://rvm.io)

# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
# branch - Branch name to deploy. (needed by mina/git)

set :application_name, 'xens'
set :domain, '127.0.0.1'
set :deploy_to, '/var/www/xens'
set :repository, 'https://github.com/snex/xens.git'
set :branch, 'master'

# Optional settings:
# set :user, 'foobar' # Username in the server to SSH to.
# set :port, '30000' # SSH port number.
# set :forward_agent, true # SSH forward_agent.

# Shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
# Some plugins already add folders to shared_dirs like `mina/rails` add `public/assets`, `vendor/bundle` and many more
# run `mina -d` to see all folders and files already included in `shared_dirs` and `shared_files`
# set :shared_dirs, fetch(:shared_dirs, []).push('public/assets')
# set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')

# This task is the environment that is loaded for all remote run commands, such as
# `mina deploy` or `mina rake`.
task :remote_environment do
# If you're using rbenv, use this to load the rbenv environment.
# Be sure to commit your .ruby-version or .rbenv-version to your repository.
# invoke :'rbenv:load'

# For those using RVM, use this to load an RVM version@gemset.
# invoke :'rvm:use', 'ruby-2.5.3@default'
end

# Put any custom commands you need to run at setup
# All paths in `shared_dirs` and `shared_paths` will be created on their own.
task :setup do
# command %{rbenv install 2.5.3 --skip-existing}
# command %{rvm install ruby-2.5.3}
# command %{gem install bundler}
end

desc "Deploys the current version to the server."
task :deploy do
# uncomment this line to make sure you pushed your local branch to the remote origin
# invoke :'git:ensure_pushed'
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
command 'cargo build -r'
invoke :'deploy:cleanup'

on :launch do
invoke :'systemctl:restart', 'xens'
end
end

# you can use `run :local` to run tasks on local machine before of after the deploy scripts
# run(:local){ say 'done' }
end

# For help in making your deploy script, see the Mina documentation:
#
# - https://github.com/mina-deploy/mina/tree/master/docs

0 comments on commit 486c2bf

Please sign in to comment.