Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(dotrun): remove start_django_db #5331

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -162,39 +162,6 @@ while [[ -n "${1:-}" ]] && [[ "${1:0:1}" == "-" ]]; do
shift
done

start_django_db () {
# Run the database if necessary
if grep -q django.db.backends.postgresql_psycopg2 */settings.py 2> /dev/null; then
# Create isolated network
if ! docker network inspect ${network_name} &> /dev/null; then
docker network create ${network_name}
fi

# Start the database
trap "kill_container ${db_container}" EXIT;
if ! docker inspect -f {{.State.Running}} ${db_container} &>/dev/null; then
docker run \
--name ${db_container} `# Name the container` \
--rm `# Remove the container once it's finished` \
--volume "${db_volume}":/var/lib/postgresql/data `# Store dependencies in a docker volume` \
${http_proxy} `# Include HTTP proxy if needed` \
--network ${network_name} `# Use an isolated network` \
--network-alias db `# Call this container "db" on the network so it can be found` \
--detach `# Run in the background` \
postgres `# Use the image for node version 7`
fi

# Wait for it
wait_time=0
until docker exec ${db_container} pg_isready || [ $wait_time -eq 4 ]; do
sleep $(( wait_time++ ))
done

# Provision database
run_as_user "${network}" python3 manage.py migrate
fi
}

kill_container () {
container_name="${1}"

Expand Down Expand Up @@ -397,8 +364,6 @@ case $run_command in
fi
done

start_django_db

# Run the serve container, publishing the port, and detaching if required
run_as_user "--env PORT=${PORT} --publish ${PORT}:${PORT} ${publish_forward_ports} ${publish_extra_ports} ${detach} ${run_serve_docker_opts} ${module_volumes}" yarn run serve $*
;;
Expand Down Expand Up @@ -529,7 +494,6 @@ case $run_command in
done

update_dependencies
start_django_db

if ${run_as_root}; then
docker_run "${expose_ports}" $@
Expand Down Expand Up @@ -559,7 +523,6 @@ case $run_command in
done

update_dependencies
start_django_db

if ${run_as_root}; then
docker_run "${expose_ports}" yarn run $@
Expand Down
Loading