def deploy(): """Initialise or update the git clone - you can safely rerun this. e.g. to update the server fab -H <host> deploy """ # Ensure we have a mailserver setup for our domain # Note that you may have problems if you intend to run more than one # site from the same server setup_env() show_environment() setup_postgis_2() base_path, code_path, git_url, repo_alias, site_name = get_vars() fastprint('Checking out %s to %s as %s' % (git_url, base_path, repo_alias)) update_git_checkout(base_path, git_url, repo_alias) update_index() require.postfix.server(site_name) update_apache(code_path) require.deb.package('python-dev') require.deb.package('libpq-dev') require.deb.package('libgeos-c1') require.deb.package('vim') require.deb.package('curl') require.deb.package('pandoc') update_venv(code_path) set_db_permissions() with cd(os.path.join(code_path, 'django_project')): run('../venv/bin/python manage.py syncdb --noinput ') run('../venv/bin/python manage.py migrate') # if we are testing under vagrant, deploy our local media and db #if 'vagrant' in env.fg.home: # with cd(code_path): # run('cp /vagrant/projecta.db .') # run('touch django_project/core/wsgi.py') #sync_media_to_server() collectstatic() fastprint('*******************************************\n') fastprint(red(' Don\'t forget set ALLOWED_HOSTS in ')) fastprint(' django_project/core/settings/prod.py') fastprint(' to the domain name for the site.') fastprint('*******************************************\n')
def get_vars(): """Helper method to get standard deployment vars. :returns: A tuple containing the following: * base_path: Workspace dir e.g. ``/home/foo/python`` * code_path: Project dir e.g. ``/home/foo/python/osm-reporter`` * git_url: Url for git checkout - use http for read only checkout * repo_alias: Name of checkout folder e.g. ``osm-reporter`` * site_name: Name for the web site e.g. ``osm-reporter`` :rtype: tuple """ setup_env() site_name = 'osm' base_path = '/home/web/' git_url = 'http://github.com/timlinux/osm-reporter.git' repo_alias = 'osm-reporter' code_path = os.path.abspath(os.path.join(base_path, repo_alias)) return base_path, code_path, git_url, repo_alias, site_name
def get_vars(): """Helper method to get standard deployment vars. :returns: A tuple containing the following: * base_path: Workspace dir e.g. ``/home/foo/python`` * code_path: Project dir e.g. ``/home/foo/python/inasafe`` * git_url: Url for git checkout - use http for read only checkout * repo_alias: Name of checkout folder e.g. ``inasafe-dev`` * site_name: Name for the web site e.g. ``experimental.inasafe.org`` :rtype: tuple """ setup_env() fastprint(green('Getting project variables\n')) site_name = 'experimental.inasafe.org' base_path = '/home/%s/dev/python' % env.user git_url = 'git://github.com/AIFDR/inasafe.git' repo_alias = 'inasafe-test' code_path = os.path.abspath(os.path.join(base_path, repo_alias)) return base_path, code_path, git_url, repo_alias, site_name
def deploy(): """Initialise or update the git clone - you can safely rerun this. e.g. to update the server fab -H <host> deploy """ # Ensure we have a mailserver setup for our domain # Note that you may have problems if you intend to run more than one # site from the same server setup_env() show_environment() base_path, code_path, git_url, repo_alias, site_name = get_vars() fastprint('Checking out %s to %s as %s' % (git_url, base_path, repo_alias)) update_git_checkout(base_path, git_url, repo_alias) require.postfix.server(site_name) update_apache(code_path) require.deb.package('python-dev') update_venv(code_path) fastprint('*******************************************\n') fastprint(' Setup completed.') fastprint('*******************************************\n')