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

Database isn't getting initialized after setting up docker #246

Open
fwextensions opened this issue Nov 10, 2022 · 2 comments
Open

Database isn't getting initialized after setting up docker #246

fwextensions opened this issue Nov 10, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@fwextensions
Copy link
Collaborator

After doing a fresh install, the database is no longer getting initialized.

Logs

$ npm run docker:start

> [email protected] docker:start
> docker compose up

[+] Running 14/14
 ⠿ db Pulled                                                                                                                        17.7s
   ⠿ e9995326b091 Pull complete                                                                                                      7.5s
   ⠿ a0cb03f17886 Pull complete                                                                                                      7.7s
   ⠿ bb26f7e78134 Pull complete                                                                                                      7.8s
   ⠿ c8e073b7ae91 Pull complete                                                                                                      7.9s
   ⠿ 99b5b1679915 Pull complete                                                                                                      8.3s
   ⠿ 55c520fc03c5 Pull complete                                                                                                      8.4s
   ⠿ d0ac84d6672c Pull complete                                                                                                      8.4s
   ⠿ 4effb95d5849 Pull complete                                                                                                      8.5s
   ⠿ 0d6d87c178f1 Pull complete                                                                                                     15.3s
   ⠿ 43c8b5f8bcaa Pull complete                                                                                                     15.3s
   ⠿ 825548df579f Pull complete                                                                                                     15.4s
   ⠿ 3878b693881a Pull complete                                                                                                     15.4s
   ⠿ c0e50aa09815 Pull complete                                                                                                     15.5s
[+] Building 146.9s (12/12) FINISHED
 => [internal] load build definition from Dockerfile                                                                                 0.0s
 => => transferring dockerfile: 32B                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                    0.0s
 => => transferring context: 34B                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/node:18.10.0-bullseye                                                             1.3s
 => [internal] load build context                                                                                                    2.8s
 => => transferring context: 6.70MB                                                                                                  2.3s
 => [1/7] FROM docker.io/library/node:18.10.0-bullseye@sha256:9d8a6466c6385e05f62f8ccf173e80209efb0ff4438f321f09ddf552b05af3ba       0.0s
 => CACHED [2/7] RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - &&     echo "deb http://apt.po  0.0s
 => CACHED [3/7] RUN echo "export PATH=/opt/node/app/node_modules/.bin:/opt/node/app/server/node_modules/.bin:/opt/node/app/client/  0.0s
 => CACHED [4/7] RUN mkdir -p /opt/node/app                                                                                          0.0s
 => [5/7] ADD . /opt/node/app                                                                                                       15.0s
 => [6/7] WORKDIR /opt/node/app                                                                                                      0.1s
 => [7/7] RUN cd client && yarn && yarn build && cd .. &&     cd server && yarn && cd .. &&     cd user-guides && yarn && cd .. &  114.6s
 => exporting to image                                                                                                              13.0s
 => => exporting layers                                                                                                             13.0s
 => => writing image sha256:b63bbdb093cd0198ec169ed7393471209f95b428d58449ea0fa0f5a73284b6bb                                         0.0s
 => => naming to docker.io/library/bats-server-server                                                                                0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 3/3
 ⠿ Network bats-server_default     Created                                                                                           0.0s
 ⠿ Container bats-server-db-1      Created                                                                                           0.2s
 ⠿ Container bats-server-server-1  Created                                                                                           9.7s
Attaching to bats-server-db-1, bats-server-server-1
bats-server-db-1      | ********************************************************************************
bats-server-db-1      | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
bats-server-db-1      |          anyone with access to the Postgres port to access your database without
bats-server-db-1      |          a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
bats-server-db-1      |          documentation about "trust":
bats-server-db-1      |          https://www.postgresql.org/docs/current/auth-trust.html
bats-server-db-1      |          In Docker's default configuration, this is effectively any other
bats-server-db-1      |          container on the same system.
bats-server-db-1      |
bats-server-db-1      |          It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
bats-server-db-1      |          it with "-e POSTGRES_PASSWORD=password" instead to set a password in
bats-server-db-1      |          "docker run".
bats-server-db-1      | ********************************************************************************
bats-server-db-1      | The files belonging to this database system will be owned by user "postgres".
bats-server-db-1      | This user must also own the server process.
bats-server-db-1      |
bats-server-db-1      | The database cluster will be initialized with locale "en_US.utf8".
bats-server-db-1      | The default database encoding has accordingly been set to "UTF8".
bats-server-db-1      | The default text search configuration will be set to "english".
bats-server-db-1      |
bats-server-db-1      | Data page checksums are disabled.
bats-server-db-1      |
bats-server-db-1      | fixing permissions on existing directory /var/lib/postgresql/data ... ok
bats-server-db-1      | creating subdirectories ... ok
bats-server-db-1      | selecting dynamic shared memory implementation ... posix
bats-server-db-1      | selecting default max_connections ... 100
bats-server-db-1      | selecting default shared_buffers ... 128MB
bats-server-db-1      | selecting default time zone ... Etc/UTC
bats-server-db-1      | creating configuration files ... ok
bats-server-db-1      | running bootstrap script ... ok
bats-server-server-1  | yarn run v1.22.19
bats-server-server-1  | $ nf start -j Procfile.dev
bats-server-db-1      | performing post-bootstrap initialization ... ok
bats-server-server-1  | [OKAY] Loaded ENV .env File as KEY=VALUE Format
bats-server-db-1      | syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
bats-server-db-1      | You can change this by editing pg_hba.conf or using the option -A, or
bats-server-db-1      | --auth-local and --auth-host, the next time you run initdb.
bats-server-db-1      | ok
bats-server-db-1      |
bats-server-db-1      |
bats-server-db-1      | Success. You can now start the database server using:
bats-server-db-1      |
bats-server-db-1      |     pg_ctl -D /var/lib/postgresql/data -l logfile start
bats-server-db-1      |
bats-server-server-1  | 2:30:56 AM client.1  |  $ yarn; craco --openssl-legacy-provider start
bats-server-server-1  | 2:30:56 AM server.1  |  $ yarn; ./bin/init; nodemon -V --ignore ./test ./bin/www
bats-server-server-1  | 2:30:56 AM sass.1    |  $ sass --load-path=node_modules/uswds/dist/scss --style=compressed src/theme/styles.scss build/libraries/uswds/theme/styles_pre.css --watch
bats-server-db-1      | waiting for server to start....2022-11-10 02:30:56.074 UTC [49] LOG:  starting PostgreSQL 12.12 (Debian 12.12-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
bats-server-db-1      | 2022-11-10 02:30:56.078 UTC [49] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
bats-server-db-1      | 2022-11-10 02:30:56.119 UTC [50] LOG:  database system was shut down at 2022-11-10 02:30:55 UTC
bats-server-db-1      | 2022-11-10 02:30:56.131 UTC [49] LOG:  database system is ready to accept connections
bats-server-db-1      |  done
bats-server-db-1      | server started
bats-server-db-1      |
bats-server-db-1      | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
bats-server-db-1      |
bats-server-db-1      | waiting for server to shut down...2022-11-10 02:30:56.223 UTC [49] LOG:  received fast shutdown request
bats-server-db-1      | .2022-11-10 02:30:56.231 UTC [49] LOG:  aborting any active transactions
bats-server-db-1      | 2022-11-10 02:30:56.232 UTC [49] LOG:  background worker "logical replication launcher" (PID 56) exited with exit code 1
bats-server-db-1      | 2022-11-10 02:30:56.233 UTC [51] LOG:  shutting down
bats-server-db-1      | 2022-11-10 02:30:56.264 UTC [49] LOG:  database system is shut down
bats-server-db-1      |  done
bats-server-db-1      | server stopped
bats-server-db-1      |
bats-server-db-1      | PostgreSQL init process complete; ready for start up.
bats-server-db-1      |
bats-server-db-1      | 2022-11-10 02:30:56.345 UTC [1] LOG:  starting PostgreSQL 12.12 (Debian 12.12-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
bats-server-db-1      | 2022-11-10 02:30:56.345 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
bats-server-db-1      | 2022-11-10 02:30:56.345 UTC [1] LOG:  listening on IPv6 address "::", port 5432
bats-server-db-1      | 2022-11-10 02:30:56.352 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
bats-server-db-1      | 2022-11-10 02:30:56.387 UTC [68] LOG:  database system was shut down at 2022-11-10 02:30:56 UTC
bats-server-db-1      | 2022-11-10 02:30:56.411 UTC [1] LOG:  database system is ready to accept connections
bats-server-server-1  | 2:30:56 AM server.1  |  [1/4] Resolving packages...
bats-server-server-1  | 2:30:56 AM client.1  |  [1/4] Resolving packages...
bats-server-server-1  | 2:30:56 AM server.1  |  success Already up-to-date.
bats-server-server-1  | 2:30:56 AM server.1  |  /bin/sh: 1: ./bin/init: Permission denied
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] 2.0.18
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] to restart at any time, enter `rs`
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] or send SIGHUP to 113 to restart
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] ignoring: ./test/**/*
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] watching path(s): *.*
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] watching extensions: js,mjs,json
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] starting `node ./bin/www`
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] forking
bats-server-server-1  | 2:30:56 AM server.1  |  [nodemon] child pid: 126
bats-server-server-1  | 2:30:57 AM server.1  |  [nodemon] watching 59 files
bats-server-server-1  | 2:30:57 AM client.1  |  success Already up-to-date.
bats-server-server-1  | 2:30:59 AM client.1  |  [HPM] Proxy created: /api,/auth,/libraries,/wss  -> http://localhost:4000
bats-server-server-1  | 2:30:59 AM client.1  |  ℹ 「wds」: Project is running at http://172.19.0.3/
bats-server-server-1  | 2:30:59 AM client.1  |  ℹ 「wds」: webpack output is served from
bats-server-server-1  | 2:30:59 AM client.1  |  ℹ 「wds」: Content not from webpack is served from /opt/node/app/client/public
bats-server-server-1  | 2:30:59 AM client.1  |  ℹ 「wds」: 404s will fallback to /
bats-server-server-1  | 2:30:59 AM client.1  |  Starting the development server...
bats-server-server-1  | 2:31:00 AM client.1  |  Browserslist: caniuse-lite is outdated. Please run the following command: `npx browserslist --update-db`
bats-server-server-1  | 2:31:01 AM sass.1    |  Compiled src/theme/styles.scss to build/libraries/uswds/theme/styles_pre.css.
bats-server-server-1  | 2:31:01 AM sass.1    |  Sass is watching for changes. Press Ctrl-C to stop.
bats-server-server-1  | 2:31:05 AM postcss.1 |  $ postcss --verbose build/libraries/uswds/theme/styles_pre.css --use autoprefixer -o build/libraries/uswds/theme/styles.css --watch
bats-server-server-1  | 2:31:06 AM postcss.1 |  Processing build/libraries/uswds/theme/styles_pre.css...
bats-server-server-1  | 2:31:06 AM postcss.1 |  Browserslist: caniuse-lite is outdated. Please run the following command: `npx browserslist --update-db`
bats-server-server-1  | 2:31:07 AM postcss.1 |  Finished build/libraries/uswds/theme/styles_pre.css in 977 ms
bats-server-server-1  | 2:31:07 AM postcss.1 |  Waiting for file changes...
bats-server-server-1  | 2:31:32 AM client.1  |  Compiled successfully!
bats-server-server-1  | 2:31:32 AM client.1  |  You can now view routed-client in the browser.
bats-server-server-1  | 2:31:32 AM client.1  |    Local:            http://localhost:3000
bats-server-server-1  | 2:31:32 AM client.1  |    On Your Network:  http://172.19.0.3:3000
bats-server-server-1  | 2:31:32 AM client.1  |  Note that the development build is not optimized.
bats-server-server-1  | 2:31:32 AM client.1  |  To create a production build, use yarn build.
bats-server-server-1  | 3:00:24 AM server.1  |  GET /api/users/me 401 3.327 ms - -
bats-server-server-1  | 3:00:24 AM server.1  |  GET /auth/local/login 200 9.685 ms - 1676
bats-server-server-1  | 3:00:26 AM server.1  |  GET /auth/local/login 304 1.632 ms - -
bats-server-db-1      | 2022-11-10 03:00:29.794 UTC [104] FATAL:  database "bats" does not exist
bats-server-server-1  | 3:00:29 AM server.1  |  POST /auth/local/login 200 28.570 ms - 1697

@francisli
Copy link
Collaborator

Ok, here's the problem:

bats-server-server-1  | 2:30:56 AM server.1  |  /bin/sh: 1: ./bin/init: Permission denied

Need to figure out why this is happening on your computer and not mine...?

@fwextensions fwextensions added the bug Something isn't working label Nov 10, 2022
@fwextensions
Copy link
Collaborator Author

Looks like it due to executable bits not getting set correctly when cloning the repo into WSL2 via Windows git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants