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

Dev sanity #16256

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ resetdb: .state/docker-build-base
docker compose pause web worker
docker compose up -d db
docker compose exec --user postgres db /docker-entrypoint-initdb.d/init-dbs.sh
docker compose exec --user postgres db psql -U postgres warehouse -f /post-migrations.sql
rm -f .state/db-populated .state/db-migrated
$(MAKE) initdb
docker compose unpause web worker
Expand All @@ -114,6 +115,7 @@ resetdb: .state/docker-build-base
.state/db-populated: .state/db-migrated
docker compose run --rm web python -m warehouse sponsors populate-db
docker compose run --rm web python -m warehouse classifiers sync
docker compose exec --user postgres db psql -U postgres warehouse -f /post-migrations.sql
miketheman marked this conversation as resolved.
Show resolved Hide resolved
mkdir -p .state && touch .state/db-populated

.state/db-migrated: .state/docker-build-base
Expand Down
2 changes: 1 addition & 1 deletion dev/db/docker-entrypoint-initdb.d/init-dbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ EOF
xz -d -f -k /example.sql.xz --stdout | psql -d warehouse -U "$POSTGRES_USER" -v ON_ERROR_STOP=1 -1 -f -

psql -d warehouse -U "$POSTGRES_USER" <<-EOF
UPDATE users SET name='Ee Durbin' WHERE username='ewdurbin'
UPDATE users SET name='Ee Durbin' WHERE username='ewdurbin';
EOF
5 changes: 5 additions & 0 deletions dev/db/post-migrations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Set password to 'password' hashed with argon
UPDATE users SET password = '$argon2id$v=19$m=1024,t=6,p=6$EiLE2Nsbo9S6N+acs/beGw$ccyZDCZstr1/+Y/1s3BVZHOJaqfBroT0JCieHug281c';

-- Set TOTP secret to IU7UP3EMIPI7EBPQUUSEHEJUFNBIWOYG for select users
UPDATE users SET totp_secret = '\x453f47ec8c43d1f205f0a5244391342b428b3b06' WHERE username IN ('ewdurbin', 'di', 'dstufft', 'miketheman');
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
volumes:
- ./dev/db/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:z
- ./dev/example.sql.xz:/example.sql.xz:z
- ./dev/db/post-migrations.sql:/post-migrations.sql:z
- ./bin/wait-for-db:/usr/local/bin/wait-for-db:z

stripe:
Expand Down Expand Up @@ -110,7 +111,7 @@ services:

web:
image: warehouse:docker-compose
command: gunicorn --reload --reload-extra-file=warehouse/api/openapi.yaml -b 0.0.0.0:8000 --access-logfile - --error-logfile - warehouse.wsgi:application
command: gunicorn --reload --reload-extra-file=warehouse/api/openapi.yaml -w 4 -b 0.0.0.0:8000 --access-logfile - --error-logfile - warehouse.wsgi:application
Copy link
Member

@miketheman miketheman Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change disabled the debug toolbar, as shown:

/opt/warehouse/lib/python3.12/site-packages/pyramid_debugtoolbar/toolbar.py:244: UserWarning: pyramid_debugtoolbar has detected that the application is being served by a forking / multiprocess web server. The toolbar relies on global state to work and is not compatible with this environment. The toolbar will be disabled.

What was the behavior you observed that led to adding this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops!

I experienced lockups pretty regularly when I had two browsers open with different profiles attempting to interact with the web server.

env_file: dev/environment
pull_policy: never
volumes: *base_volumes
Expand Down