Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created March 11, 2020 21:02
Show Gist options
  • Save rafaelrinaldi/42696fd4ffd77955cfd49726298974bc to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/42696fd4ffd77955cfd49726298974bc to your computer and use it in GitHub Desktop.
~/work/mortgage master
❯ make db-nuke db-start
cd /Users/rrinaldi/work/mortgage/mortgage && /Library/Developer/CommandLineTools/usr/bin/make mono-db-nuke
Makefile:33: warning: overriding commands for target `secrets-prod'
../Makefile:462: warning: ignoring old commands for target `secrets-prod'
docker-compose down --rmi local --volumes --remove-orphans
WARNING: The DB_SCHEMA_USER_PASSWORD variable is not set. Defaulting to a blank string.
Removing network mortgage_default
Removing image mortgage_postgres
rm -rf ~/data/postgres_data
/Library/Developer/CommandLineTools/usr/bin/make ecr-login
# use `aws ecr get-login-password` if it's available, with an
# ugly fallback until everyone is on aws-cli/1.17.10 or later
if aws ecr get-login-password &> /dev/null; then \
aws ecr get-login-password --region us-east-1; \
else \
aws ecr get-login --no-include-email --region us-east-1 | cut -d ' ' -f 6; \
fi | docker login --username AWS --password-stdin https://299544290090.dkr.ecr.us-east-1.amazonaws.com
Login Succeeded
cd /Users/rrinaldi/work/mortgage/mortgage && /Library/Developer/CommandLineTools/usr/bin/make mono-db-start
Makefile:33: warning: overriding commands for target `secrets-prod'
../Makefile:462: warning: ignoring old commands for target `secrets-prod'
docker-compose up --build --detach
WARNING: The DB_SCHEMA_USER_PASSWORD variable is not set. Defaulting to a blank string.
Creating network "mortgage_default" with the default driver
Building postgres
Step 1/22 : FROM postgres:10-alpine
---> 97f1045583bf
Step 2/22 : LABEL maintainer="dev@better.com"
---> Running in 80cc191833a4
Removing intermediate container 80cc191833a4
---> a9874a63986a
Step 3/22 : COPY --chown=postgres:postgres scripts /app/mortgage/postgres/scripts
---> d67b6dad2b5e
Step 4/22 : COPY --chown=postgres:postgres seed /app/mortgage/postgres/seed
---> 74c55f28179e
Step 5/22 : COPY --chown=postgres:postgres postgresql.conf /var/lib/postgres/conf.d/postgresql.conf
---> 2c54cb43df60
Step 6/22 : COPY --chown=postgres:postgres initialize.sh /docker-entrypoint-initdb.d/initialize.sh
---> 5d26ded2e865
Step 7/22 : RUN chmod -R +x /app/mortgage/postgres/scripts
---> Running in b4ba6780895b
Removing intermediate container b4ba6780895b
---> 47fdcf2cb0d1
Step 8/22 : ARG COMMIT
---> Running in 4fbca139f0e6
Removing intermediate container 4fbca139f0e6
---> aae98a45712e
Step 9/22 : ARG DB_ADMIN_USER
---> Running in 92d8fdf10fd2
Removing intermediate container 92d8fdf10fd2
---> 4e1d762daf45
Step 10/22 : ARG DB_BOOT_SCHEMA
---> Running in 6a2d20ed3dca
Removing intermediate container 6a2d20ed3dca
---> a3d93992700b
Step 11/22 : ARG DB_NAME
---> Running in 57fd7fb090d1
Removing intermediate container 57fd7fb090d1
---> f9b0c28ae45b
Step 12/22 : ARG DB_SCHEMA
---> Running in f2d5bf9135cf
Removing intermediate container f2d5bf9135cf
---> 920046932514
Step 13/22 : ARG DB_SCHEMA_USER
---> Running in 89c53bc53406
Removing intermediate container 89c53bc53406
---> d9baf3e59693
Step 14/22 : ARG DB_SCHEMA_USER_PASSWORD
---> Running in 80cee6c25028
Removing intermediate container 80cee6c25028
---> 8d1989f39b67
Step 15/22 : ARG DB_TEST_MODE
---> Running in 65c78ba082f1
Removing intermediate container 65c78ba082f1
---> 573d136d24f4
Step 16/22 : ARG DB_SCHEMA_HEAD_VERSION
---> Running in 1eda05d654cf
Removing intermediate container 1eda05d654cf
---> 87f27982d9c5
Step 17/22 : ARG POSTGRES_HOST_AUTH_METHOD=trust
---> Running in b727591e9bd7
Removing intermediate container b727591e9bd7
---> 99b110d2e2b7
Step 18/22 : ENV COMMIT $COMMIT
---> Running in abb0fc3cbfe6
Removing intermediate container abb0fc3cbfe6
---> 440dad6e8ddf
Step 19/22 : ENV POSTGRES_HOST_AUTH_METHOD $POSTGRES_HOST_AUTH_METHOD
---> Running in 141c0506c1fc
Removing intermediate container 141c0506c1fc
---> 122863bbbbc8
Step 20/22 : ENV PGDATA /pgdata
---> Running in 2bdde218a186
Removing intermediate container 2bdde218a186
---> be6c7bd87d3e
Step 21/22 : RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
---> Running in bc26fa116cf4
Removing intermediate container bc26fa116cf4
---> 6994e67c9aa2
Step 22/22 : RUN /app/mortgage/postgres/scripts/bootstrap.sh postgres
---> Running in f1e92eaabfc5
********************************************************************************
WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
anyone with access to the Postgres port to access your database without
a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
documentation about "trust":
https://www.postgresql.org/docs/current/auth-trust.html
In Docker's default configuration, this is effectively any other
container on the same system.
It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
it with "-e POSTGRES_PASSWORD=password" instead to set a password in
"docker run".
********************************************************************************
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2020-03-11 21:01:46.550 UTC [29] WARNING: no usable system locales were found
ok
syncing data to disk ...
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
ok
Success. You can now start the database server using:
pg_ctl -D /pgdata -l logfile start
waiting for server to start....2020-03-11 21:01:47.460 UTC [34] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-03-11 21:01:47.471 UTC [35] LOG: database system was shut down at 2020-03-11 21:01:46 UTC
2020-03-11 21:01:47.473 UTC [34] LOG: database system is ready to accept connections
done
server started
/app/mortgage/postgres/scripts/bootstrap.sh: running /docker-entrypoint-initdb.d/initialize.sh
Initializing database postgres@/var/run/postgresql:mortgage
DROP DATABASE
NOTICE: database "mortgage" does not exist, skipping
CREATE DATABASE
Initializing database postgres@/var/run/postgresql:mortgage_test
DROP DATABASE
NOTICE: database "mortgage_test" does not exist, skipping
CREATE DATABASE
NOTICE: role "better_boot" does not exist, skipping
DROP ROLE
CREATE ROLE
GRANT
waiting for server to shut down...2020-03-11 21:01:48.474 UTC [34] LOG: received fast shutdown request
.2020-03-11 21:01:48.475 UTC [34] LOG: aborting any active transactions
2020-03-11 21:01:48.476 UTC [34] LOG: worker process: logical replication launcher (PID 41) exited with exit code 1
2020-03-11 21:01:48.476 UTC [36] LOG: shutting down
2020-03-11 21:01:48.490 UTC [34] LOG: database system is shut down
done
server stopped
db initialized
Removing intermediate container f1e92eaabfc5
---> 63b71f1abb17
Successfully built 63b71f1abb17
Successfully tagged mortgage_postgres:latest
Pulling auth (299544290090.dkr.ecr.us-east-1.amazonaws.com/better-auth:73e3732)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.
Continue with the new image? [yN]y
Building postgres
Step 1/22 : FROM postgres:10-alpine
---> 97f1045583bf
Step 2/22 : LABEL maintainer="dev@better.com"
---> Using cache
---> a9874a63986a
Step 3/22 : COPY --chown=postgres:postgres scripts /app/mortgage/postgres/scripts
---> Using cache
---> d67b6dad2b5e
Step 4/22 : COPY --chown=postgres:postgres seed /app/mortgage/postgres/seed
---> Using cache
---> 74c55f28179e
Step 5/22 : COPY --chown=postgres:postgres postgresql.conf /var/lib/postgres/conf.d/postgresql.conf
---> Using cache
---> 2c54cb43df60
Step 6/22 : COPY --chown=postgres:postgres initialize.sh /docker-entrypoint-initdb.d/initialize.sh
---> Using cache
---> 5d26ded2e865
Step 7/22 : RUN chmod -R +x /app/mortgage/postgres/scripts
---> Using cache
---> 47fdcf2cb0d1
Step 8/22 : ARG COMMIT
---> Using cache
---> aae98a45712e
Step 9/22 : ARG DB_ADMIN_USER
---> Using cache
---> 4e1d762daf45
Step 10/22 : ARG DB_BOOT_SCHEMA
---> Using cache
---> a3d93992700b
Step 11/22 : ARG DB_NAME
---> Using cache
---> f9b0c28ae45b
Step 12/22 : ARG DB_SCHEMA
---> Using cache
---> 920046932514
Step 13/22 : ARG DB_SCHEMA_USER
---> Using cache
---> d9baf3e59693
Step 14/22 : ARG DB_SCHEMA_USER_PASSWORD
---> Using cache
---> 8d1989f39b67
Step 15/22 : ARG DB_TEST_MODE
---> Using cache
---> 573d136d24f4
Step 16/22 : ARG DB_SCHEMA_HEAD_VERSION
---> Using cache
---> 87f27982d9c5
Step 17/22 : ARG POSTGRES_HOST_AUTH_METHOD=trust
---> Using cache
---> 99b110d2e2b7
Step 18/22 : ENV COMMIT $COMMIT
---> Using cache
---> 440dad6e8ddf
Step 19/22 : ENV POSTGRES_HOST_AUTH_METHOD $POSTGRES_HOST_AUTH_METHOD
---> Using cache
---> 122863bbbbc8
Step 20/22 : ENV PGDATA /pgdata
---> Using cache
---> be6c7bd87d3e
Step 21/22 : RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
---> Using cache
---> 6994e67c9aa2
Step 22/22 : RUN /app/mortgage/postgres/scripts/bootstrap.sh postgres
---> Using cache
---> 63b71f1abb17
Successfully built 63b71f1abb17
Successfully tagged mortgage_postgres:latest
Pulling auth (299544290090.dkr.ecr.us-east-1.amazonaws.com/better-auth:73e3732)...
ERROR: pull access denied for 299544290090.dkr.ecr.us-east-1.amazonaws.com/better-auth, repository does not exist or may require 'docker login': denied: User: arn:aws:iam::299544290090:user/rrinaldi is not authorized to perform: ecr:BatchGetImage on resource: arn:aws:ecr:us-east-1:299544290090:repository/better-auth
make[1]: *** [mono-db-start] Error 1
make: *** [db-start] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment