Skip to content

Commit a7afcc5

Browse files
authored
Merge pull request #922 from zhe-CUNY/main
Docker-compose, allauth.google as temp fix, and geo.js
2 parents 57b6629 + 9b22bec commit a7afcc5

File tree

17 files changed

+571
-427
lines changed

17 files changed

+571
-427
lines changed

.env.example

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
DISTR_DB_NAME=representable_db
2+
DISTR_DB_USER=representable
3+
DISTR_DB_PASS=password
4+
DISTR_DB_HOST=db
5+
#DATABASE_URL=
6+
7+
SECRET_KEY=django-insecure-key-1234
8+
DJANGO_SETTINGS_MODULE=representable.settings.dev
9+
10+
DISTR_MAPBOX_KEY=
11+
MAPBOX_USER_NAME=
12+
13+
# used for Signature model (hashes CommunityEntry submission)
14+
AUDIT_SECRET=long_line_of_text
15+
16+
# https://docs.allauth.org/en/latest/socialaccount/providers/google.html#google
17+
# Make sure to include the app's url in Clients > OAuth 2.0 Client IDs > Authorized redirect URIs
18+
GOOGLE_OAUTH_CLIENT_ID=
19+
GOOGLE_OAUTH_SECRET=
20+
21+
# https://www.google.com/recaptcha/admin
22+
# data-sitekey and api key
23+
RECAPTCHA_PUBLIC=
24+
RECAPTCHA_PRIVATE=
25+
26+
# https://www.perspectiveapi.com/
27+
#
28+
PERSPECTIVE_API_KEY=
29+
30+
31+
# used for s3 bucket storage for geojsons of user submissions
32+
AWS_ACCESS_KEY_ID=
33+
AWS_SECRET_ACCESS_KEY=
34+
AWS_STORAGE_BUCKET_NAME=representable
35+
36+
# email smtp (current using sendgrid to switch over to mailgun)
37+
SENDGRID_API_KEY=
38+
SENDGRID_USERNAME=
39+
SENDGRID_PASSWORD=
40+
41+
MAILGUN_DOMAIN=
42+
MAILGUN_API_KEY=
43+
MAILGUN_PUBLIC_KEY=
44+
MAILGUN_SMTP_LOGIN=
45+
MAILGUN_SMTP_PASSWORD=
46+
MAILGUN_SMTP_PORT=587
47+
MAILGUN_SMTP_SERVER=smtp.mailgun.org

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,7 @@ google_token.json
142142
# Translation text outputs
143143
*translations.txt
144144
*untranslated.txt
145-
*tanslation.txt
145+
*tanslation.txt
146+
147+
# Docker
148+
pg_data/

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM python:3.9.23-slim
2+
3+
WORKDIR /app
4+
5+
RUN apt-get update
6+
7+
RUN apt-get install -y libpq-dev postgresql-client python3-dev \
8+
gdal-bin libgdal-dev python3-gdal\
9+
make build-essential libssl-dev zlib1g-dev \
10+
libbz2-dev libreadline-dev libsqlite3-dev \
11+
llvm libncurses5-dev libncursesw5-dev xz-utils \
12+
tk-dev libffi-dev liblzma-dev \
13+
--no-install-recommends && \
14+
apt-get clean -y
15+
16+
# Set GDAL/GEOS library paths
17+
ENV GDAL_LIBRARY_PATH=/lib/x86_64-linux-gnu/libgdal.so.36
18+
ENV GEOS_LIBRARY_PATH=/lib/x86_64-linux-gnu/libgeos_c.so.1
19+
ENV LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
20+
21+
RUN pip install --upgrade pip
22+
23+
COPY ./requirements.txt /app/requirements.txt
24+
RUN pip install -r requirements.txt
25+
26+
ENTRYPOINT ["bash"]

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ Representable is creating maps of communities to fight for equal and impartial r
77
### Documentation
88
Check out our [Docs](https://docs.representable.org) site for a guide to installing Representable and contributing to various parts of the site. If you find any issues, we would love to know! Please open an issue request for any incomplete documentation.
99

10+
#### Quick start
11+
12+
```bash
13+
cp .env.example .env # update the variables
14+
15+
docker compose up -d
16+
docker compose exec app /bin/bash
17+
18+
# run once to: setup the database, superuser, and test the app
19+
export DJANGO_SETTINGS_MODULE=representable.settings.dev
20+
python manage.py makemigrations
21+
python manage.py migrate
22+
python manage.py createsuperuser
23+
python manage.py loaddata states.json
24+
python manage.py collectstatic
25+
python manage.py test
26+
27+
# run server
28+
python manage.py runserver 0:8000 --settings=representable.settings.dev
29+
```
30+
1031
### General Issue Reporting
1132
For bug reports and general feature requests, please open a [Github issue](https://github.com/Representable/representable/issues/new/choose). We welcome all feedback and suggestions!
1233

docker-compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
app:
3+
build: .
4+
volumes:
5+
- .:/app
6+
depends_on:
7+
- db
8+
# environment:
9+
# - DATABASE_URL=postgresql://representable:password@db/representable_db
10+
env_file:
11+
- .env
12+
ports:
13+
- "8000:8000"
14+
tty: true
15+
stdin_open: true
16+
db:
17+
image: postgis/postgis:17-3.5-alpine
18+
restart: unless-stopped
19+
environment:
20+
- POSTGRES_DB=representable_db
21+
- POSTGRES_USER=representable
22+
- POSTGRES_PASSWORD=password
23+
volumes:
24+
- ./pg_data:/var/lib/postgresql/data
25+
ports:
26+
- "127.0.0.1:5433:5432" # access via port 5433
27+
# creating a new user
28+
# psql -U public_test representable_db
29+
# CREATE USER public_test WITH encrypted password 'test';
30+
# change to select only for non-PII tables
31+
# GRANT ALL PRIVILEGES ON DATABASE representable_db to public_test;

0 commit comments

Comments
 (0)