Open douglaslamb opened 4 years ago
:thinking: maybe the database service wasn't up? Have you tried to looks at the db
service logs?
I'll check it out! Thanks.
Sent from my iPhone
On Jul 17, 2020, at 2:49 AM, Julien Maupetit notifications@github.com wrote:
🤔 maybe the database service wasn't up? Have you tried to looks at the db service logs?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I think the database started up ok. I pasted the db container's log below.
My best guess is that in crick/api/migrations/Dockerfile, using github.com/mattes/migrate (which is deprecated) instead of github.com/golang-migrate/migrate is the problem. However, I tried changing mattes to golang-migrate, and it didn't work. I pasted my terminal output for that below.
Thanks for your help!
~/crick/api$ make migrate-up
docker-compose -p crick -f docker-compose.yml -f docker-compose.tools.yml run --rm migrate up
Starting crick_db_1 ... done
Building migrate
Step 1/5 : FROM golang:1.8-alpine
---> 4cb86d3661bf
Step 2/5 : MAINTAINER William Durand <hello@tailordev.fr>
---> Using cache
---> 1cc1cfda2218
Step 3/5 : RUN apk update && apk add git && rm -r /var/cache/apk/*
---> Using cache
---> 1c3a71dbd35e
Step 4/5 : RUN go get -u -d github.com/golang-migrate/migrate/cli github.com/lib/pq
---> Running in 7bfac82f22bb
package github.com/golang-migrate/migrate/v4/internal/cli: cannot find package "github.com/golang-migrate/migrate/v4/internal/cli" in any of:
/usr/local/go/src/github.com/golang-migrate/migrate/v4/internal/cli (from $GOROOT)
/go/src/github.com/golang-migrate/migrate/v4/internal/cli (from $GOPATH)
ERROR: Service 'migrate' failed to build: The command '/bin/sh -c go get -u -d github.com/golang-migrate/migrate/cli github.com/lib/pq' returned a non-zero code: 1
make: *** [Makefile:16: migrate-up] Error 1
~/crick/api$
~/crick/api$ docker logs crick_db_1
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 /var/lib/postgresql/data ... 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
sh: locale: not found
performing post-bootstrap initialization ... No usable system locales were found.
Use the option "--debug" to see details.
ok
syncing data to disk ... ok
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.
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data -l logfile start
waiting for server to start....LOG: database system was shut down at 2020-07-18 01:59:50 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
done
server started
CREATE DATABASE
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
LOG: received fast shutdown request
LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
LOG: shutting down
waiting for server to shut down....LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
LOG: database system was shut down at 2020-07-18 01:59:51 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
~/crick/api$
@douglaslamb It seems like I found a solution: update the golang
image e.g. to 1.15-alpine
(Edit the first line of api/migrations/Dockerfile
). After this the make command is successful.
Due other Failures I can't test if this work properly on the whole project.
I am getting the following error when I run sudo make migrate-up. Thank you for writing Watson. It's great.
Debian 10.4 buster Docker 19.03.12 Digital Ocean
Sincerely