Skip to content

Commit

Permalink
Merge pull request #38 from xjlin0/attending_list_2024oct_break_title
Browse files Browse the repository at this point in the history
fix the local docker build
  • Loading branch information
xjlin0 authored Sep 20, 2024
2 parents 78b2de1 + bb680c5 commit 53fce77
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,19 +348,19 @@ SENDGRID_API_KEY=FAKE
[email protected]
DJANGO_SECRET_KEY=your_django_secret_key
```
* build and start the local machine by `docker-compose -f local.yml build && docker-compose -f local.yml up -d`. If there's error about `docker-credential-desktop`, change credsStore to credStore in `~/.docker/config.json`
* create migration files by `docker-compose -f local.yml run --rm django python manage.py makemigrations`
* migrate db by `docker-compose -f local.yml run --rm django python manage.py migrate`
* upadte content types after migration by `docker-compose -f local.yml run django python manage.py update_content_types`
* create 2 superusers by `docker-compose -f local.yml run --rm django python manage.py createsuperuser`
* import the seed data by `docker-compose -f local.yml run django python manage.py loaddata fixtures/db_seed`, data were created by:
* build and start the local machine by `docker compose -f local.yml build && docker compose -f local.yml up -d`. If there's error about `docker-credential-desktop`, change credsStore to credStore in `~/.docker/config.json`
* create migration files by `docker compose -f local.yml run --rm django python manage.py makemigrations`
* migrate db by `docker compose -f local.yml run --rm django python manage.py migrate`
* upadte content types after migration by `docker compose -f local.yml run django python manage.py update_content_types`
* create 2 superusers by `docker compose -f local.yml run --rm django python manage.py createsuperuser`
* import the seed data by `docker compose -f local.yml run django python manage.py loaddata fixtures/db_seed`, data were created by:
```
docker-compose -f local.yml run django python manage.py dumpdata -e users.user -e admin.logentry -e sessions.session -e contenttypes.contenttype -e sites.site -e account.emailaddress -e account.emailconfirmation -e socialaccount.socialtoken -e auth.permission -e pghistory.context -e pghistory.aggregateevent -e users.userhistory -e users.menushistory -e users.menuauthgroupshistory -e users.groupshistory -e users.grouppermissionshistory -e users.usergroupshistory -e users.userpermissionshistory -e users.emailaddresshistory -e users.emailconfirmationhistory -e whereabouts.organizationshistory -e whereabouts.divisionshistory -e whereabouts.placeshistory -e whereabouts.campuseshistory -e whereabouts.propertieshistory -e whereabouts.suiteshistory -e whereabouts.roomshistory -e whereabouts.countryhistory -e whereabouts.statehistory -e whereabouts.localityhistory -e whereabouts.addresshistory -e persons.categorieshistory -e persons.noteshistory -e persons.pastshistory -e persons.folkshistory -e persons.attendeeshistory -e persons.folkattendeeshistory -e persons.relationshistory -e persons.registrationshistory -e persons.attendingshistory -e persons.attendingmeetshistory -e occasions.assemblieshistory -e occasions.attendanceshistory -e occasions.charactershistory -e occasions.gatheringshistory -e occasions.meetshistory -e occasions.messagetemplateshistory -e occasions.priceshistory -e occasions.teamshistory -e occasions.calendarhistory -e occasions.calendarrelationhistory -e occasions.eventhistory -e occasions.eventrelationhistory -e occasions.occurrencehistory -e occasions.rulehistory -e occasions.periodictaskhistory -e occasions.crontabschedulehistory -e occasions.intervalschedulehistory -e users.permissionshistory -e users.GroupPermissionProxy -e users.UserGroupProxy -e users.UserPermissionProxy --indent 2 > fixtures/db_seed2.json
docker compose -f local.yml run django python manage.py dumpdata -e users.user -e admin.logentry -e sessions.session -e contenttypes.contenttype -e sites.site -e account.emailaddress -e account.emailconfirmation -e socialaccount.socialtoken -e auth.permission -e pghistory.context -e pghistory.aggregateevent -e users.userhistory -e users.menushistory -e users.menuauthgroupshistory -e users.groupshistory -e users.grouppermissionshistory -e users.usergroupshistory -e users.userpermissionshistory -e users.emailaddresshistory -e users.emailconfirmationhistory -e whereabouts.organizationshistory -e whereabouts.divisionshistory -e whereabouts.placeshistory -e whereabouts.campuseshistory -e whereabouts.propertieshistory -e whereabouts.suiteshistory -e whereabouts.roomshistory -e whereabouts.countryhistory -e whereabouts.statehistory -e whereabouts.localityhistory -e whereabouts.addresshistory -e persons.categorieshistory -e persons.noteshistory -e persons.pastshistory -e persons.folkshistory -e persons.attendeeshistory -e persons.folkattendeeshistory -e persons.relationshistory -e persons.registrationshistory -e persons.attendingshistory -e persons.attendingmeetshistory -e occasions.assemblieshistory -e occasions.attendanceshistory -e occasions.charactershistory -e occasions.gatheringshistory -e occasions.meetshistory -e occasions.messagetemplateshistory -e occasions.priceshistory -e occasions.teamshistory -e occasions.calendarhistory -e occasions.calendarrelationhistory -e occasions.eventhistory -e occasions.eventrelationhistory -e occasions.occurrencehistory -e occasions.rulehistory -e occasions.periodictaskhistory -e occasions.crontabschedulehistory -e occasions.intervalschedulehistory -e users.permissionshistory -e users.GroupPermissionProxy -e users.UserGroupProxy -e users.UserPermissionProxy --indent 2 > fixtures/db_seed2.json
```
* go to Django admin to add the first organization and all groups to the first user (superuser) at http://192.168.99.100:8008/admin123/users/user/
* use browser to open http://192.168.99.100:8008/ and http://192.168.99.100:8025/
* Enter postgres db console by `docker-compose -f local.yml exec postgres psql -d attendees --username=<<POSTGRES_USER in .envs/.local/.postgres>>`
* Enter Django console by `docker-compose -f local.yml run django python manage.py shell_plus`
* Enter postgres db console by `docker compose -f local.yml exec postgres psql -d attendees --username=<<POSTGRES_USER in .envs/.local/.postgres>>`
* Enter Django console by `docker compose -f local.yml run django python manage.py shell_plus`
* remote debug in PyCharm for docker, please check [django cookie doc](https://github.com/pydanny/cookiecutter-django/blob/master/{{cookiecutter.project_slug}}/docs/pycharm/configuration.rst).

</details>
Expand All @@ -382,6 +382,7 @@ EMAIL_HOST=sendgrid
* In Docker Desktop Settings, please ensure both "Use Virtualization framework" and "Use Rosetta for x86_64/amd64 emulation on Apple Silicon" options in enabled.
* build and start the Debian based local machine by `docker compose -f local.yml build && docker compose -f local.yml up -d`, your site will be at http://0.0.0.0:8008/
* to see django log: `docker compose -f local.yml logs django`
* enter the Bash shell of running container `docker compose -f local.yml run django bash`
* enter Redis-CLI by `docker exec -it redis redis-cli`


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
title="click to pause/unpause participations, double click to edit more">
<h1 class="text-center"
title="{{meet_slug}}">
{{report_title|linebreaks}}
{{report_title|linebreaksbr}}
</h1>
<div class="flex-justify-between border-bottom">
<div></div>
Expand Down
9 changes: 5 additions & 4 deletions compose/local/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG PYTHON_VERSION=3.9-slim-bullseye
ARG PYTHON_VERSION=3.10-slim-bookworm

# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python
FROM python:${PYTHON_VERSION} AS python

# Python build stage
FROM python as python-build-stage
FROM python AS python-build-stage
ARG BUILD_ENVIRONMENT=local

# Install apt packages
Expand All @@ -23,7 +23,7 @@ RUN pip wheel --wheel-dir /usr/src/app/wheels \


# Python 'run' stage
FROM python as python-run-stage
FROM python AS python-run-stage

ARG BUILD_ENVIRONMENT=local
ARG APP_HOME=/app
Expand All @@ -41,6 +41,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
# Translations dependencies
gettext curl vim wget python3-dateutil git less gdal-bin libpango-1.0-0 libpangoft2-1.0-0 \
# cleaning up unused files
&& apt-get purge -y fontconfig-config mysql-common \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

Expand Down
8 changes: 4 additions & 4 deletions compose/local/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ARG PYTHON_VERSION=3.9-slim-bullseye
ARG PYTHON_VERSION=3.10-slim-bookworm

# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python
FROM python:${PYTHON_VERSION} AS python


# Python build stage
FROM python as python-build-stage
FROM python AS python-build-stage

ENV PYTHONDONTWRITEBYTECODE 1

Expand All @@ -28,7 +28,7 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels \


# Python 'run' stage
FROM python as python-run-stage
FROM python AS python-run-stage

ARG BUILD_ENVIRONMENT
ENV PYTHONUNBUFFERED 1
Expand Down
2 changes: 1 addition & 1 deletion local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
- ./config:/app/config:z
- ./attendees:/app/attendees:z
ports:
- "7000:7000"
- "7001:7000"
command: /start-docs

mailhog:
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ flower==2.0.1 # https://github.com/mher/flower
uvicorn[standard]==0.29.0 # https://github.com/encode/uvicorn
psycopg2==2.9.9 # https://github.com/psycopg/psycopg2
unidecode==1.3.2
opencc==1.1.3 ## https://github.com/BYVoid/OpenCC
opencc==1.1.8 ## https://github.com/BYVoid/OpenCC
# opencc-python-reimplemented==0.1.6 ## https://github.com/yichen0831/opencc-python
# django-address==0.2.5 # https://github.com/furious-luke/django-address
-e git+https://github.com/xjlin0/django-address.git@address_extra_field_026#egg=django-address
Expand Down

0 comments on commit 53fce77

Please sign in to comment.