Adding new server

NOTE: All these steps must be done with root privileges

  1. [Access key] by SSH ON LOCAL machine generate new keys for server: ssh-keygen -t rsa -b 4096 -C "srv_oper"
  2. Create swap-file (http://mydebianblog.blogspot.ru/2010/05/swap-swap-linux.html)
    1. dd if=/dev/zero of=/swapfile bs=1M count=5000
    2. mkswap /swapfile
    3. swapon /swapfile
    4. echo “/swapfile none swap sw 0 0” » /etc/fstab
  3. install git: apt-get update && apt-get -y install git
  4. [Deploy key] generate key ssh-keygen -t rsa -b 4096 -C "your_github_email_account@example.com"
  5. [Deploy key] Import public park of the key into guthub (in REPO Repository->Settings->Deploy Keys, don’t forget give a meaningful name)
  6. [Deploy key] add into /home/deploy-user-name/.ssh/config:
    Host github.com
     Hostname github.com
     user git
     IdentitiesOnly yes
     IdentityFile ~/.ssh/id_rsa.deployment
    
  7. [Deploy key] chmod 600 ~/.ssh/config !!!
  8. [Deploy key] chmod 700 ~/.ssh
  9. checkout story_line2_deployment (better in /root dir) dir by: git clone github.com:fedor-malyshkin/story_line2_deployment.git provision
  10. change domain name:
    1. Add “hostname.nlp-project.ru” to /etc/hostname
    2. Add “11.22.33.44 hostname hostname.nlp-project.ru” to /etc/hosts
  11. Set timezone: sudo timedatectl set-timezone Europe/Moscow
  12. Make necessary configuration in provision settings according to new server
  13. Reboot
  14. Run provision_production.sh
  15. [Access key] sudo -u srv_oper bash on REMOTE MACHINE
  16. [Access key] add public keys to to /home/srv_oper/.ssh/authorized_keys on REMOTE MACHINE
  17. [Access key] Add entries to local SSH config (/home/XXXX/.ssh/config):
    Host YYYYY
     Hostname 11.22.33.44
     user srv_oper
     IdentitiesOnly yes
     IdentityFile ~/.ssh/rsa.YYYYYY
    

Table of content: