hackoregon / transportation-system-backend

2018 repo for the transportation api backend
MIT License
8 stars 2 forks source link

api container crashing after the migrations on Windows #34

Closed znmeb closed 6 years ago

znmeb commented 6 years ago
Postgres is unavailable - sleeping
Postgres is up
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying sessions.0001_initial... OK
: No such file or directory

Here's the current bin/local-docker-entrypoint.sh

$ cat bin/local-docker-entrypoint.sh
#! /bin/bash

# wait-for-postgres.sh
# https://docs.docker.com/compose/startup-order/

set -e

export PGPASSWORD=$POSTGRES_PASSWORD
until psql -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -p "$POSTGRES_PORT" -d "$POSTGRES_NAME" -c '\q'
do
  >&2 echo "Postgres is unavailable - sleeping"
  sleep 15
done

>&2 echo "Postgres is up"

python manage.py migrate
./manage.py runserver 0.0.0.0:8000

I can't tell if the crash is at the end of the migration or the beginning of the runserver. I'm going to see if it works on Linux before I go messing with any more line endings.

znmeb commented 6 years ago

works on a Linux host - going back to troubleshooting on Windows. I'm guessing it's a line endings problem on manage.py since that comes into the image from the Dockerfile COPY . /code/

znmeb commented 6 years ago

Yup - forcing the file to DOS line endings on Linux reproduces the problem. Bah!

znmeb commented 6 years ago

Need to test on Windows before closing

znmeb commented 6 years ago

fixed - closing