Terrastories / terrastories

Terrastories is a geostorytelling application for mapping, managing and sharing place-based stories.
https://terrastories.app
MIT License
319 stars 157 forks source link

[Docker] The step-by-step build for dev environment appears to not be working #960

Open rudokemper opened 1 year ago

rudokemper commented 1 year ago

Our SETUP.md page outlines several ways to build Terrastories: using a shell script, or building the Docker images and containers step-by-step.

It appears that the step-by-step method is having some issues. Several users have reported that running docker compose --profile dev up results in the following db issues (sharing complete log to help with debugging):

Attaching to terrastories-db-1, terrastories-web-1
terrastories-db-1   | The files belonging to this database system will be owned by user "postgres".
terrastories-db-1   | This user must also own the server process.
terrastories-db-1   | 
terrastories-db-1   | The database cluster will be initialized with locale "en_US.utf8".
terrastories-db-1   | The default database encoding has accordingly been set to "UTF8".
terrastories-db-1   | The default text search configuration will be set to "english".
terrastories-db-1   | 
terrastories-db-1   | Data page checksums are disabled.
terrastories-db-1   | 
terrastories-db-1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
terrastories-db-1   | creating subdirectories ... ok
terrastories-db-1   | selecting default max_connections ... 100
terrastories-db-1   | selecting default shared_buffers ... 128MB
terrastories-db-1   | selecting default timezone ... Etc/UTC
terrastories-db-1   | selecting dynamic shared memory implementation ... posix
terrastories-db-1   | creating configuration files ... ok
terrastories-db-1   | running bootstrap script ... ok
terrastories-db-1   | performing post-bootstrap initialization ... ok
terrastories-web-1  | The Gemfile's dependencies are satisfied
terrastories-web-1  | Starting Rails Server...
terrastories-db-1   | syncing data to disk ... ok
terrastories-db-1   | 
terrastories-db-1   | Success. You can now start the database server using:
terrastories-db-1   | 
terrastories-db-1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
terrastories-db-1   | 
terrastories-db-1   | 
terrastories-db-1   | WARNING: enabling "trust" authentication for local connections
terrastories-db-1   | You can change this by editing pg_hba.conf or using the option -A, or
terrastories-db-1   | --auth-local and --auth-host, the next time you run initdb.
terrastories-db-1   | waiting for server to start....2023-09-27 18:35:44.701 UTC [48] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
terrastories-db-1   | 2023-09-27 18:35:44.720 UTC [49] LOG:  database system was shut down at 2023-09-27 18:35:44 UTC
terrastories-db-1   | 2023-09-27 18:35:44.727 UTC [48] LOG:  database system is ready to accept connections
terrastories-db-1   |  done
terrastories-db-1   | server started
terrastories-db-1   | 
terrastories-db-1   | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/001-init.sql
terrastories-web-1  | Installing foreman...
terrastories-db-1   | psql:/docker-entrypoint-initdb.d/001-init.sql:1: NOTICE:  database "terrastories-dev" does not exist, skipping
terrastories-db-1   | DROP DATABASE
terrastories-db-1   | CREATE DATABASE
terrastories-db-1   | DROP DATABASE
terrastories-db-1   | psql:/docker-entrypoint-initdb.d/001-init.sql:4: NOTICE:  database "terrastories-test" does not exist, skipping
terrastories-web-1  | Fetching foreman-0.87.2.gem
terrastories-db-1   | CREATE DATABASE
terrastories-db-1   | 
terrastories-db-1   | 
terrastories-web-1  | Successfully installed foreman-0.87.2
terrastories-web-1  | 1 gem installed
terrastories-db-1   | 2023-09-27 18:35:45.379 UTC [48] LOG:  received fast shutdown request
terrastories-db-1   | waiting for server to shut down....2023-09-27 18:35:45.382 UTC [48] LOG:  aborting any active transactions
terrastories-db-1   | 2023-09-27 18:35:45.384 UTC [48] LOG:  background worker "logical replication launcher" (PID 55) exited with exit code 1
terrastories-db-1   | 2023-09-27 18:35:45.384 UTC [50] LOG:  shutting down
terrastories-db-1   | 2023-09-27 18:35:45.403 UTC [48] LOG:  database system is shut down
terrastories-db-1   |  done
terrastories-db-1   | server stopped
terrastories-db-1   | 
terrastories-db-1   | PostgreSQL init process complete; ready for start up.
terrastories-db-1   | 
terrastories-db-1   | 2023-09-27 18:35:45.516 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
terrastories-db-1   | 2023-09-27 18:35:45.516 UTC [1] LOG:  listening on IPv6 address "::", port 5432
terrastories-db-1   | 2023-09-27 18:35:45.521 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
terrastories-db-1   | 2023-09-27 18:35:45.542 UTC [76] LOG:  database system was shut down at 2023-09-27 18:35:45 UTC
terrastories-db-1   | 2023-09-27 18:35:45.549 UTC [1] LOG:  database system is ready to accept connections
terrastories-web-1  | 18:35:46 web.1     | started with pid 20
terrastories-web-1  | 18:35:46 css.1     | started with pid 21
terrastories-web-1  | 18:35:46 webpack.1 | started with pid 25
terrastories-web-1  | 18:35:46 css.1     | yarn run v1.22.19
terrastories-web-1  | 18:35:46 css.1     | $ ./bin/build-css --watch
terrastories-web-1  | 18:35:46 css.1     | ./bin/build-css: line 3: sass: not found
terrastories-web-1  | 18:35:46 css.1     | error Command failed with exit code 127.
terrastories-web-1  | 18:35:46 css.1     | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
terrastories-web-1  | 18:35:47 webpack.1 | yarn run v1.22.19
terrastories-web-1  | 18:35:47 webpack.1 | error Command "webpack-dev-server" not found.
terrastories-web-1  | 18:35:47 webpack.1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
terrastories-web-1  | 18:35:47 css.1     | exited with code 127
terrastories-web-1  | 18:35:47 system    | sending SIGTERM to all processes
terrastories-web-1  | 18:35:47 webpack.1 | exited with code 1
terrastories-web-1  | 18:35:47 web.1     | terminated by SIGTERM
terrastories-web-1 exited with code 0

Presumably, it is because some steps from the setup script are being skipped in the step-by-step workflow:

## init db
docker compose run --rm db postgres --version

## start db
docker compose up -d db

## build app
docker compose --profile $profile build

## setup database
docker compose --profile $profile run --rm $container bin/rails db:migrate

## Seed database with demo data
if [[ "$profile" = "dev" ]]; then
  docker compose --profile dev run --rm $container bin/rails db:seed
fi

## Precompile assets for offline mode
if [[ "$profile" = "offline" ]]; then
  docker compose --profile offline run --rm -e RAILS_ENV=offline $container bin/rails assets:precompile
fi

## run yarn
docker compose --profile $profile run --rm $container yarn

If somebody wants to follow the shell script line-by-line and can confirm that it is working, it would be great to modify SETUP.md and list out the granular steps.

Dxuian commented 1 month ago

am willing to help if this repo isnt deprecated or this issue isnt solved

rudokemper commented 1 month ago

Hi @Dxuian. This repo is not deprecated, but regular dev work is a bit dormant, and I think our approach to this script is likely to be revisited when we have time to revisit overall architecture for Terrastories. But thank you for your interest and offer!