Skip to content
Browse files

changed all ~/ for absolute paths

  • Loading branch information...
1 parent 9e45584 commit bd78693e63a995fd26dc4dcc29d6786728d3705c @gcollazo committed Jun 26, 2011
Showing with 26 additions and 17 deletions.
  1. +12 −12 fabulous.py
  2. +14 −5 fabulous_conf.py
View
24 fabulous.py
@@ -60,9 +60,9 @@ def setup_servers():
f = open("%s/config_files/nginx.conf" % file_path, 'r')
config_file = f.read()
f.close()
- run(_write_to(config_file, "~/nginx.conf"))
+ run(_write_to(config_file, "/home/%(SERVER_USERNAME)s/nginx.conf" % fabconf))
sudo("mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old")
- sudo("mv ~/nginx.conf /etc/nginx/nginx.conf")
+ sudo("mv /home/%(SERVER_USERNAME)s/nginx.conf /etc/nginx/nginx.conf" %fanconf)
sudo("chown root:root /etc/nginx/nginx.conf")
# /etc/nginx/sites-enabled/default
@@ -71,9 +71,9 @@ def setup_servers():
f = open("%s/config_files/nginx-app-proxy" % file_path, 'r')
proxy_file = f.read()
f.close()
- run(_write_to(proxy_file % fabconf, "~/%(PROJECT_NAME)s" % fabconf))
+ run(_write_to(proxy_file % fabconf, "/home/%(SERVER_USERNAME)s/%(PROJECT_NAME)s" % fabconf))
sudo("rm -rf /etc/nginx/sites-enabled/default")
- sudo("mv ~/%(PROJECT_NAME)s /etc/nginx/sites-available/%(PROJECT_NAME)s" % fabconf)
+ sudo("mv /home/%(SERVER_USERNAME)s/%(PROJECT_NAME)s /etc/nginx/sites-available/%(PROJECT_NAME)s" % fabconf)
sudo("ln -s /etc/nginx/sites-available/%(PROJECT_NAME)s /etc/nginx/sites-enabled/%(PROJECT_NAME)s" % fabconf)
sudo("chown root:root /etc/nginx/sites-available/%(PROJECT_NAME)s" % fabconf)
@@ -85,13 +85,13 @@ def setup_servers():
print(yellow("Setup virtualenvwrapper..."))
sudo("mkdir %(VIRTUALENV_DIR)s" % fabconf)
sudo("chown -R ubuntu:ubuntu %(VIRTUALENV_DIR)s" % fabconf)
- run('echo "export WORKON_HOME=%(VIRTUALENV_DIR)s" >> ~/.profile' % fabconf)
- run('echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.profile')
- run("source ~/.profile")
+ run('echo "export WORKON_HOME=%(VIRTUALENV_DIR)s" >> /home/%(SERVER_USERNAME)s/.profile' % fabconf)
+ run('echo "source /usr/local/bin/virtualenvwrapper.sh" >> /home/%(SERVER_USERNAME)s/.profile')
+ run("source /home/%(SERVER_USERNAME)s/.profile")
# Make a webapps alias
print(yellow("Making 'webapps' alias for webapps folder..."))
- run("""echo "alias webapps='cd %(APPS_DIR)s'" >> ~/.profile""" % fabconf)
+ run("""echo "alias webapps='cd %(APPS_DIR)s'" >> /home/%(SERVER_USERNAME)s/.profile""" % fabconf)
# Create WebApps Folder
print(yellow("Create webapps folder..."))
@@ -102,10 +102,10 @@ def setup_servers():
print(yellow("Setup git..."))
run("git config --global user.name %(GIT_USERNAME)s" % fabconf)
run("git config --global user.email %(ADMIN_EMAIL)s" % fabconf)
- put(fabconf['GITHUB_DEPLOY_KEY'], "~/.ssh/%s" % fabconf['GITHUB_DEPLOY_KEY'].split('/')[-1])
- run("chmod 600 ~/.ssh/%s" % fabconf['GITHUB_DEPLOY_KEY'].split('/')[-1])
- run("""echo 'IdentityFile ~/.ssh/%s' >> ~/.ssh/config""" % fabconf['GITHUB_DEPLOY_KEY'].split('/')[-1])
- run('ssh-keyscan github.com >> ~/.ssh/known_hosts')
+ put(fabconf['GITHUB_DEPLOY_KEY_PATH'], "/home/%(SERVER_USERNAME)s/.ssh/%(GITHUB_DEPLOY_KEY_NAME)s")
+ run("chmod 600 /home/%(SERVER_USERNAME)s/.ssh/%(GITHUB_DEPLOY_KEY_NAME)s" % fabconf)
+ run("""echo 'IdentityFile /home/%(SERVER_USERNAME)s/.ssh/%(GITHUB_DEPLOY_KEY_NAME)s' >> /home/%(SERVER_USERNAME)s/.ssh/config""" % fabconf)
+ run('ssh-keyscan github.com >> /home/%(SERVER_USERNAME)s/.ssh/known_hosts')
@hosts('')
View
19 fabulous_conf.py
@@ -7,16 +7,22 @@
# Username for connecting to EC2 instaces
fabconf['SERVER_USERNAME'] = "ubuntu"
-# Full path of the ssh key you use to connect to EC2 instances
-fabconf['SSH_PRIVATE_KEY_PATH'] = '/path/to/.ssh/key.pem'
+# Full local path for .ssh
+fabconf['SSH_PATH'] = "/path/to/.ssh"
+
+# Name of the private key file you use to connect to EC2 instances
+fabconf['GITHUB_DEPLOY_KEY_NAME'] = "key.pem"
+
+# Don't edit. Full path of the ssh key you use to connect to EC2 instances
+fabconf['SSH_PRIVATE_KEY_PATH'] = '%s/%s' % (fabconf['SSH_PATH'], fabconf['GITHUB_DEPLOY_KEY_NAME'])
# Project name: polls
fabconf['PROJECT_NAME'] = "polls"
# Where to install apps
fabconf['APPS_DIR'] = "/home/ubuntu/webapps"
-# Where you want your project installed: /home/ubuntu/webapps/PROJECT_NAME
+# Where you want your project installed: /APPS_DIR/PROJECT_NAME
fabconf['PROJECT_PATH'] = "%s/%s" % (fabconf['APPS_DIR'], fabconf['PROJECT_NAME'])
# App domains
@@ -31,8 +37,11 @@
# Email for the server admin
fabconf['ADMIN_EMAIL'] = "webmaster@localhost"
-# Local path for deployment key you use for github
-fabconf['GITHUB_DEPLOY_KEY'] = "/path/to/.ssh/github"
+# Name of the private key file used for github deployments
+fabconf['GITHUB_DEPLOY_KEY_NAME'] = "github"
+
+# Don't edit. Local path for deployment key you use for github
+fabconf['GITHUB_DEPLOY_KEY_PATH'] = "%s/%s" % (fabconf['SSH_PATH'], fabconf['GITHUB_DEPLOY_KEY_NAME'])
# Path to the repo of the application you want to install
fabconf['GITHUB_REPO'] = "https://github.com/gcollazo/Blank-django-Project.git"

0 comments on commit bd78693

Please sign in to comment.
Something went wrong with that request. Please try again.