Production deploy
This commit is contained in:
		
							parent
							
								
									3241db2ef1
								
							
						
					
					
						commit
						2640690cc6
					
				
					 1 changed files with 42 additions and 0 deletions
				
			
		
							
								
								
									
										42
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								.drone.yml
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -62,3 +62,45 @@ trigger:
 | 
			
		|||
 | 
			
		||||
depends_on:
 | 
			
		||||
  - testing
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
kind: pipeline
 | 
			
		||||
type: docker
 | 
			
		||||
name: Production deploy
 | 
			
		||||
 | 
			
		||||
steps:
 | 
			
		||||
- name: build
 | 
			
		||||
  image: golang:1.17-buster # this one is used in production
 | 
			
		||||
  #image: golang:1.17-bullseye # this one is used in sandbox
 | 
			
		||||
  commands:
 | 
			
		||||
  - go mod tidy
 | 
			
		||||
  - make build
 | 
			
		||||
 | 
			
		||||
- name: deploy
 | 
			
		||||
  image: debian:buster
 | 
			
		||||
  environment:
 | 
			
		||||
    #NODES: node-18.rosti.cz 83.167.243.34
 | 
			
		||||
    NODES: 83.167.243.34 83.167.243.34
 | 
			
		||||
    SSH_KEY:
 | 
			
		||||
      from_secret: SSH_KEY
 | 
			
		||||
  commands:
 | 
			
		||||
  - apt update && apt install -y ssh
 | 
			
		||||
  - |
 | 
			
		||||
      for NODE in $NODES; do
 | 
			
		||||
        echo "\033[0;32mDeploying $NODE\033[0m"
 | 
			
		||||
        mkdir ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
 | 
			
		||||
        ssh-keyscan $NODE > ~/.ssh/known_hosts
 | 
			
		||||
        scp node-api root@$NODE:/usr/local/bin/node-api_
 | 
			
		||||
        ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
 | 
			
		||||
        ssh root@$NODE systemctl restart node-api
 | 
			
		||||
      done
 | 
			
		||||
 | 
			
		||||
depends_on:
 | 
			
		||||
  - testing
 | 
			
		||||
 | 
			
		||||
trigger:
 | 
			
		||||
  event:
 | 
			
		||||
  - promote
 | 
			
		||||
  target:
 | 
			
		||||
  - production
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue