.gitlab-ci.yml 945 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
image: iandennismiller/application

stages:
  - production

Deploy to Production:
  stage: production
  cache:
    policy: pull
  before_script:
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
  script:
    - rsync --exclude '.git*' -a . "$SSH_SCP_DESTINATION"
Ian Dennis Miller's avatar
Ian Dennis Miller committed
20
    - ssh "$SSH_DESTINATION" "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh && workon twitter-save && cd ~/snapshot && make install"
21 22 23 24
  
# GitLab:Settings:CI/CD:Variables `ssh-keyscan $SSH_SCP_DESTINATION` >> $SSH_KNOWN_HOSTS
# ssh-keygen -t rsa -b 4096 -C snapshot-deploy-key -f ./deploy-key > $SSH_PRIVATE_KEY
# no-port-forwarding,no-pty,command="scp -v -r -d -t /home/idm/snapshot" >> ~/.ssh/authorized_keys