Skip to content

Commit

Permalink
build(dotrun): remove start_django_db (#5331)
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski committed Mar 5, 2024
1 parent 447be38 commit 1fd5c12
Showing 1 changed file with 0 additions and 37 deletions.
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

0 comments on commit 1fd5c12

Please sign in to comment.