Commit 8a5cf317 authored by Ernesto Rodriguez Ortiz's avatar Ernesto Rodriguez Ortiz
Browse files

Run drush archive_dump in the docker container localhost may not have mysql installed.

parent 2370ba5a
......@@ -141,17 +141,16 @@ def container_start(role='local'):
'-d -p {}:80'.format(env.bind_port),
mounts=[(env.workspace, env.docker_workspace, True)]):
# If container was successful build, get the IP address and show it to the user.
global CONTAINER_IP
CONTAINER_IP = h.fab_run(role, 'docker inspect -f "{{{{.NetworkSettings.IPAddress}}}}" '
env.container_ip = h.fab_run(role, 'docker inspect -f "{{{{.NetworkSettings.IPAddress}}}}" '
'{}_container'.format(env.project_name), capture=True)
if env.interactive_mode:
h.fab_update_hosts(CONTAINER_IP, env.site_hostname)
h.fab_update_hosts(env.container_ip, env.site_hostname)
print(green('Docker container {}_container was build successful. '
'To visit the Website open a web browser in http://{} or '
'http://localhost:{}.'.format(env.project_name, env.site_hostname, env.bind_port)))
h.fab_update_container_ip()
h.fab_update_container_ip(env.container_ip)
else:
print(red('Docker image {}/drupal not found and is a requirement to run the {}_container.'
......
......@@ -130,8 +130,8 @@ def site_install():
@task
@roles('local')
def archive_dump(role='local'):
@roles('docker')
def archive_dump(role='docker'):
"""
Archive the platform for release or deployment.
:param role Default 'role' where to run the task
......
......@@ -123,13 +123,10 @@ def fab_remove_from_hosts(site_hostname):
local('sudo sed -i "/{}/d" /etc/hosts'.format(site_hostname))
def fab_update_container_ip():
container_ip = fab_run('local', 'docker inspect -f "{{{{.NetworkSettings.IPAddress}}}}" '
'{}_container'.format(env.project_name), capture=True)
env.container_ip = container_ip
def fab_update_container_ip(container_ip):
local('sed -i "/env.container_ip/d" {}/local_vars.py'.format(os.path.dirname(os.path.abspath(__file__))))
local('sed -i "/# Docker auto-added container IP/a env.container_ip = \'{}\'" {}/local_vars.py'.format(''.join(container_ip), os.path.dirname(os.path.abspath(__file__))))
local('sed -i "/# Docker auto-added container IP/a env.container_ip = \'{}\'" '
'{}/local_vars.py'.format(''.join(container_ip), os.path.dirname(os.path.abspath(__file__))))
def fab_update_hosts(ip, site_hostname):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment