Перенес запуск скриптов деплоя в общий файл
This commit is contained in:
		
							
								
								
									
										19
									
								
								app/gitea/deploy.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								app/gitea/deploy.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| from fabric import Connection | ||||
| import os | ||||
| import shlex | ||||
|  | ||||
|  | ||||
| def deploy(context, app_name, ssh_host): | ||||
|     docker_compose = os.path.join(os.path.dirname(__file__), "docker-compose.yml") | ||||
|     print("Deploy app from", docker_compose) | ||||
|     print("Start setup remote host", ssh_host) | ||||
|     with Connection(ssh_host) as c: | ||||
|         c.put( | ||||
|             local=docker_compose, | ||||
|             remote=f"/home/{app_name}/docker-compose.yml", | ||||
|         ) | ||||
|         c.run("cp .env .env.prod") | ||||
|         c.run("mkdir -p data") | ||||
|         c.run( | ||||
|             f"docker-compose --project-name {shlex.quote(app_name)} --env-file=.env.prod up --detach --remove-orphans" | ||||
|         ) | ||||
| @@ -1,23 +0,0 @@ | ||||
| from fabric import Connection | ||||
| from invoke import task | ||||
| import shlex | ||||
|  | ||||
| # Run task with `invoke deploy` | ||||
|  | ||||
| APP_NAME = "gitea" | ||||
| SSH_HOST = f"{APP_NAME}@158.160.115.150" | ||||
|  | ||||
|  | ||||
| @task | ||||
| def deploy(c): | ||||
|     print("Ready to setup remote host") | ||||
|     with Connection(SSH_HOST) as c: | ||||
|         c.put( | ||||
|             local="docker-compose.yml", | ||||
|             remote=f"/home/{APP_NAME}/docker-compose.yml", | ||||
|         ) | ||||
|         c.run("cp .env .env.prod") | ||||
|         c.run("mkdir -p data") | ||||
|         c.run( | ||||
|             f"docker-compose --project-name {shlex.quote(APP_NAME)} --env-file=.env.prod up --detach --remove-orphans" | ||||
|         ) | ||||
		Reference in New Issue
	
	Block a user