Skip to content

Commit

Permalink
manual python script for pushing to webserver.
Browse files Browse the repository at this point in the history
Type `./deploy.py` to run the script. Enter your username exactly how it
is on the webserver. For example, `aaron`. Enter your password
and...magic.
  • Loading branch information
a-stjohn committed Feb 20, 2020
1 parent b4db119 commit 0e2ac86
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "/usr/bin/python3"
}
8 changes: 0 additions & 8 deletions deploy

This file was deleted.

23 changes: 23 additions & 0 deletions deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
import subprocess

# Get Username
username = input('Enter your username: ')

allowed_users = ['aaron', 'tim', 'jt']

web_server_host = "docs1.tn.ixsystems.com"
web_server_dir = "/var/www/html/docs1"

rsync_target = username + "@" + web_server_host + ":" + web_server_dir

rsync_command = ['rsync', '-avz', '--delete', 'public/', rsync_target]
hugo_command = ['hugo', '-t', 'docsy', '-d', 'public', '--gc', '--minify', '--cleanDestinationDir']


# Conditional to check if user is allowed to run command
if username.lower() in allowed_users:
subprocess.run(hugo_command)
subprocess.run(rsync_command)
else:
print('You do not have permission to run this script.')

0 comments on commit 0e2ac86

Please sign in to comment.