自动打包部署
This commit is contained in:
parent
8e9642ab63
commit
a350e0085f
|
|
@ -12,15 +12,13 @@ def backup_database():
|
|||
"""
|
||||
import datetime
|
||||
name = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
command = '''pg_dump "user=postgres password=zcDsj2021 dbname=hberp" >
|
||||
/home/lighthouse/backup/hberp_{}.sql'''.format(name)
|
||||
command = '''pg_dump "user=postgres password=zcDsj2021 dbname=hberp" > /home/lighthouse/backup/hberp_{}.sql'''.format(name)
|
||||
completed = subprocess.run(command, shell=True, capture_output=True, text=True)
|
||||
return completed
|
||||
|
||||
@shared_task
|
||||
def reload_server():
|
||||
os.chdir('/home/lighthouse/hberp')
|
||||
command = 'sudo git pull && sudo service supervisor reload'
|
||||
command = 'bash /home/lighthouse/hberp/hb_server/git.sh'
|
||||
completed = subprocess.run(command, shell=True, capture_output=True, text=True)
|
||||
return completed
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
cd /home/lighthouse/hberp
|
||||
sudo git pull
|
||||
cd /home/lighthouse/hberp/hb_client
|
||||
npm run build:prod
|
||||
rsync -avu /home/lighthouse/hberp/hb_client/dist/ /home/lighthouse/hberp/hb_server/vuedist/
|
||||
sudo service supervisor reload
|
||||
Loading…
Reference in New Issue