Open UnknownGnome opened 5 years ago
Myself, I hosted AWX on a Kubernetes/Openshift cluster, en configured a port forward via the openshift tool to the host I run awx-migratre on. This matches the default settings
#export AWX_SRC_DBHOST='localhost'
#export AWX_SRC_DBPORT='5432'
..
#export AWX_DST_DBPASSWORD='awxpass'
#export AWX_DST_DBHOST='localhost'
In a pure docker environment, you'd need to export/publish those database ports to the local host running docker, and run the script there. Perhaps as simple as restarting those containers with an extra -p options - see man docker, the --publish
option:
-p, --publish ip:[hostPort]:containerPort | [hostPort:]containerPort
Publish a container's port, or range of ports, to the host.
If you're using the Ansible playbooks that the AWX project supplies you with, you can also publish those ports by adjusting the docker-compose.yaml.j2
template or by adjusting the Ansible playbook itself, depending on your version of AWX:
In versions 2.1.0 and 3.0.1 (and probably other earlier versions as well) - Edit the local_docker/tasks/standalone.yaml
file to include published_ports
for the postgres container task:
- name: Activate postgres container
docker_container:
name: postgres
state: started
restart_policy: unless-stopped
published_ports:
- 5432:5432
image: "{{ postgresql_image }}"
volumes:
- "{{ postgres_data_dir }}:/var/lib/postgresql/data:Z"
In version 4.0.0 and other later versions (I've only been playing with 4.0.0 lately) - Edit the local_docker/templates/docker-compose.yml.j2
file to add a port publishing argument:
{% if pg_hostname is not defined %}
postgres:
image: postgres:9.6
container_name: awx_postgres
restart: unless-stopped
volumes:
- {{ postgres_data_dir }}:/var/lib/postgresql/data:Z
environment:
POSTGRES_USER: {{ pg_username }}
POSTGRES_PASSWORD: {{ pg_password }}
POSTGRES_DB: {{ pg_database }}
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
{% endif %}
Then re-run the playbook to provision the changes to your Docker containers:
sudo ansible-playbook -i installer/inventory installer/install.yml
Once you've done that, you should have published the specified port on the container to the specified port on the host, and the script ought to be able to communicate with the Postgres container then.
I have AWX installed via Docker. So there's a separate postgres container. Being sort of unfamiliar with Docker and Postgres, how do I configure awx-migrate-wrapper to connect to the postgres container?