Skip to content

Instantly share code, notes, and snippets.

@YarikST YarikST/Deploy
Created Oct 10, 2019

Embed
What would you like to do?
. Update system
sudo apt update -y && sudo apt upgrade -y && sudo apt full-upgrade -y
. Install standart
sudo apt-get install -y libmagickwand-dev imagemagick ffmpeg libpq-dev htop curl git gem gnupg build-essential
*node.js(auto install npm) - https://nodejs.org/en/download/package-manager
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo ln -sf /usr/bin/nodejs /usr/local/bin/node
. Install Rvm with Ruby and standart configureted
sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash
sudo usermod -a -G rvm `whoami`
if sudo grep -q secure_path /etc/sudoers; then sudo sh -c "echo export rvmsudo_secure_path=1 >> /etc/profile.d/rvm_secure_path.sh" && echo Environment variable installed; fi
rvm requirements
source ~/.rvm/scripts/rvm
source ~/.profile
rvm reload
rvm install ruby-2.4.0
rvm --default use ruby-2.4.0
echo 'gem: --no-document' >> ~/.gemrc
rvm @global do gem install bundler
. Install Nginx with Passenger
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 &&
sudo apt-get install -y apt-transport-https ca-certificates
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list' && sudo apt-get update -y
sudo apt-get install -y nginx-extras passenger
. Environment variables
echo 'export RAILS_ENV=production
export LC_ALL=en_US.UTF-8
source ~/.profile
. Swap
sudo rm -f /swapfile
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
echo 'vm.swappiness=30' | sudo tee -a /etc/sysctl.conf
echo 'vm.vfs_cache_pressure = 50' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
# output results to terminal
echo Swap Status:
swapon -s
df -h
. Configure project
#https://www.ssh.com/ssh/keygen/
ssh-keygen -t rsa -b 4096 -f path
ssh-copy-id -i ~/.ssh/tatu-key-ecdsa user@host
~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
git config --global user.name "yaroslav"
git config --global user.email "yaroslavmalukst@gmail.com"
sudo mkdir /var/www/multilang
sudo chown ubuntu: /var/www/multilang/
git clone git@gitlab.pettersonapps.com:Backend/langcards-backend.git .
#git clone https://username:password@github.com/username/repository.git
. Configure Nginx
passenger-config about ruby-command
##passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.4.0@langcards/wrappers/ruby
. Remove other
sudo apt update -y && sudo apt upgrade -y && sudo apt full-upgrade -y && sudo apt autoremove -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.