Published | 20/11/2024 |
---|---|
Last Updated | 20/11/2024 |
<aside> 🔥
This article is incomplete.
</aside>
I want something simple. Docker feels like too much work, and the need to store Docker images somewhere is not appealing to me.
I often used Capistrano in the past, even wrote an article about it but I still feel like Capistrano is a little bit slow and don't fully understand how it works under the hood. Too much magic and poor documentation don't help either.
Here are the reason I go forward with mina:
This should be similar to "Create deploy account" section from Setup and deploy Rails app with Capistrano.
These are mostly copied from Setup and deploy Rails app with Capistrano with some updates. Note that these are for Ubuntu server.
# Update package index
sudo apt-get update
# Install curl
sudo apt-get install curl
# install RVM
gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL <https://get.rvm.io> | bash -s stable
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
source ~/.rvm/scripts/rvm # activate RVM
rvm requirements # install dependencies
# Install Ruby 3.2.2 and bundler
rvm install 3.2.2
rvm use 3.2.2 --default
gem install bundler -v 2.5.3 -V
# Install git
sudo apt-get install git-core
# Install database engine based on your project
sudo apt-get install mysql-server
sudo apt-get install postgresql postgresql-contrib libpq-dev
# Install nvm to manage node versions
curl -o- <https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh> | bash
nvm install 20
# Install yarn
npm install --global yarn
# Install nginx
sudo apt-get install nginx
# Others
sudo apt-get install redis-server
sudo apt-get install imagemagick
Just install mina gem
gem install mina
Run mina init
to create config/deploy.rb
. All deployment code will be here.
The first step is go to config/deploy.rb
to make changes to basic information like remote server IP, remote server user, application name, git repo, etc...
It rarely works out of the box as we always have various custom needs like using Puma for application server, RVM to manage Ruby versions and so on. The following sections will deal with setup for common extensions.