Create a new, start with the smallest droplet. Use Ubuntu 20.04, log in as root.
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential git-core curl zlib1g-dev libssl-dev libreadline-dev libmysqlclient-dev nginx -y
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install nodejs -y
create user 'deploy'
adduser deploy
Add to sudoers group
usermod -aG sudo deploy
Switch user to 'deploy'
su - deploy
Create ssh key
ssh-keygen
Create sym link for webroot
cd ~
ln -s /var/www/html html
sudo visudo
deploy ALL=(ALL) NOPASSWD:ALL
nano /etc/ssh/sshd_config
PasswordAuthenticacion Yes
sudo service ssh restart
Check swapfile
free -h
Check freespace
df -h
Create a 4gb Swap File
sudo fallocate -l 4G /swapfile
Verify
ls -lh /swapfile
Lock it down
sudo chmod 600 /swapfile
Make it swap
sudo mkswap /swapfile
Enable it
sudo swapon /swapfile
Verify
sudo swapon --show
Check swapfile
free -h
Make it permanent
sudo cp /etc/fstab /etc/fstab.bak;
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
How To Install Nginx on Ubuntu 16.04
Install NGINX
sudo apt-get update
sudo apt-get install nginx
Check status
systemctl status nginx
Tweak UFW firewall
sudo ufw allow 'OpenSSH'
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo ufw status
Install CURL, get your IP, and check that you can request a page in your browser!
sudo apt-get install curl
curl -4 icanhazip.com
Actions*
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
https://github.com/rbenv/rbenv#basic-github-checkout
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
rbenv install 2.6.3
rbenv global 2.6.3
gem install bundler -v 1.17.2
gem install rake
Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma
Install Rails and bundler
gem install rails -v '5.2.3'
gem install bundler
Authorize your server to read from your repo, you'll have to add a deployment key to your repo. To do this you must copy your ~/.ssh/id_rsa.pub
file to your repo (make sure this is your deployment user, eg. rails
)
subir master.key a shared en el server
rake secret
EDITOR='subl --wait' rails credentials:edit
gem 'capistrano', '3.11.2' gem 'capistrano-rbenv', '2.1.4' gem 'capistrano-rails', '1.4.0' gem 'capistrano3-puma', require: false
systemctl status mysql.service
https://www.digitalocean.com/community/tutorials/how-to-install-the-latest-mysql-on-ubuntu-18-04
sudo mysql_secure_installation
sudo mysql -u root
apt-key adv --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5 apt-get install libmysqlclient-dev
https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost
Add your local key to the server, if this doesn't work just add your local public key (id_rsa.pub) to /home/deploy/.ssh/authorized_keys
ssh-rsa ... ssh-rsa ...
-
Update rsa keys
-
Replace IP in deploy file
-
Update nginx site config
-
Active puma service on boot
- certbot Let's Encrypt