fix bug in deployment where pip gets updated during initial
bootstrap,but then screws up the rest of the deployment including pip install. Break up the deployment into two parts. NOTE: must find a way to have deployment as one part alone Changes to be committed: modified: modules/deploy.py modified: modules/pip.py
This commit is contained in:
parent
5faa4fd99b
commit
152b5658a9
2 changed files with 146 additions and 1 deletions
|
|
@ -193,6 +193,151 @@ def bootstrap():
|
|||
db.init()
|
||||
|
||||
|
||||
@task
|
||||
def bootstrap_part1():
|
||||
# import database as db
|
||||
|
||||
# configuration = env.config
|
||||
|
||||
# if env.debug:
|
||||
# logger = loggify('deploy', 'bootstrap_part1')
|
||||
|
||||
#
|
||||
# not doing a full sync, because we have to set up the rootpath,
|
||||
# virtualenv, files, dir structure, etc. This means we aren't
|
||||
# going to upload gunicorn and supervisor until after we've done
|
||||
# everything else at the end of the bootstrapping process
|
||||
|
||||
sync(full=False)
|
||||
|
||||
# continue setting up the rootpath and virtualenv
|
||||
setup_rootpath()
|
||||
|
||||
setup_virtualenv()
|
||||
|
||||
|
||||
@task
|
||||
def bootstrap_part2():
|
||||
import database as db
|
||||
|
||||
configuration = env.config
|
||||
|
||||
if env.debug:
|
||||
logger = loggify('deploy', 'bootstrap')
|
||||
|
||||
# create the django project
|
||||
from django import create_project
|
||||
create_project()
|
||||
|
||||
#
|
||||
# link virtualenv to rootpath/private/virtualenv
|
||||
|
||||
src_virtual = configuration.virtualenv.paths.root
|
||||
dst_virtual = configuration.paths.server.virtual
|
||||
|
||||
#
|
||||
# link templates to rootpath/private/templates
|
||||
|
||||
src_templates = configuration.paths.django.templates
|
||||
dst_templates = configuration.paths.server.django.templates
|
||||
|
||||
#
|
||||
# link the django code in the project directory to the appropriate location
|
||||
# in the rootpath directory
|
||||
|
||||
src_code = configuration.paths.django.root
|
||||
dst_code = configuration.paths.server.django.code
|
||||
|
||||
#
|
||||
# I corrected the linking code so that it deletes already existing
|
||||
# links before creating them, otherwise you get really weird errors
|
||||
# where the a link is recreated within the destination link
|
||||
|
||||
from utils import link_create
|
||||
|
||||
if env.debug:
|
||||
logger.debug("virtualenv.root : %s"
|
||||
% configuration.virtualenv.paths.root)
|
||||
logger.debug("virtualenv.bin : %s\n" %
|
||||
configuration.virtualenv.paths.bin)
|
||||
|
||||
logger.debug("paths.server\n")
|
||||
|
||||
logger.debug(" - root\t: %s" % configuration.paths.server.root)
|
||||
|
||||
logger.debug(" - media\t: %s" %
|
||||
configuration.paths.server.media.static)
|
||||
|
||||
logger.debug(" - virtual\t: %s" % configuration.paths.server.virtual)
|
||||
|
||||
logger.debug(" - django.code\t: %s\n" %
|
||||
configuration.paths.server.django.code)
|
||||
|
||||
logger.debug("django templates : %s" %
|
||||
configuration.paths.django.templates)
|
||||
|
||||
logger.debug("django root : %s" %
|
||||
configuration.paths.django.root)
|
||||
|
||||
logger.debug("django settings : %s" %
|
||||
configuration.paths.django.settings.root)
|
||||
|
||||
logger.debug("django local : %s" %
|
||||
configuration.paths.django.settings.local)
|
||||
|
||||
logger.debug(link_create(src_virtual, dst_virtual, debug=True))
|
||||
logger.debug(link_create(src_templates, dst_templates, debug=True))
|
||||
logger.debug(link_create(src_code, dst_code, debug=True))
|
||||
|
||||
else:
|
||||
link_create(src_virtual, dst_virtual)
|
||||
link_create(src_templates, dst_templates)
|
||||
link_create(src_code, dst_code)
|
||||
|
||||
#
|
||||
# create and link the scripts that manage the server
|
||||
# e.g. nginx, supervisor, gunicorn
|
||||
|
||||
from nginx import upload as upload_nginx
|
||||
from supervisor import upload as upload_supervisor
|
||||
from django import generate as django_generate
|
||||
|
||||
print_console("creating gunicorn script")
|
||||
django_generate('gunicorn', True)
|
||||
django_generate('local', True)
|
||||
|
||||
print_console("creating supervisor script")
|
||||
upload_supervisor()
|
||||
|
||||
print_console("creating nginx script")
|
||||
upload_nginx()
|
||||
|
||||
#
|
||||
# instantiate docker containers if any
|
||||
|
||||
import docker
|
||||
|
||||
print_console("check to see if docker containers are used")
|
||||
|
||||
if hasattr(configuration, "docker"):
|
||||
print_console("generating docker configuration file")
|
||||
docker.generate()
|
||||
|
||||
print_console("creating and starting docker container")
|
||||
docker.create()
|
||||
else:
|
||||
print_console("no docker containers are being used. pass")
|
||||
|
||||
#
|
||||
# create and initialize the database
|
||||
|
||||
print_console("in db.generate")
|
||||
db.generate()
|
||||
|
||||
print_console("in db.init")
|
||||
db.init()
|
||||
|
||||
|
||||
@task
|
||||
def sync(full=True, extras=False):
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def bootstrap_pip():
|
|||
"""
|
||||
bootstraps pip
|
||||
"""
|
||||
upgrade()
|
||||
# upgrade()
|
||||
setup()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue