Skip to content

Commit

Permalink
Upgrade to Django 3.2 LTS and Dockerize junction (#757)
Browse files Browse the repository at this point in the history
* Upgrade Junction to Python 3.10 & Django 3.2 along with Social Login Fix (#744)

* Upgrade Python Version to 3.10 and Django Version 3.2

* Fix Github and Google Login/Signup

* new package added to the requirements file

* using f-strings

Co-authored-by: @rohitchopra-epam

* Fix unit tests add gunicorn (#748)

* Fix failing tests, Add gunicorn

Added nox method for running gunicorn

* Pin dependencies

---------

Co-authored-by: Ananya Maiti <Ananya_Maiti@epam.com>

* Dockerize Junction (#749)

* Initial commit for Dockerization

* Fix review comments and dockerignore

* Update dev.py.sample with runsslserver

* Fixes for using default settings module

* Remove Dockerfile.celery and use image from junction web image

* Update docker-compose.test.yml to not depend on postgres db

* Add static asset compilation in Docker image

* Add docker-compose.prod.yml and update server port configuration in application

* Add social oauth env vars

---------

Co-authored-by: Sanchit Balchandani <balchandani.sanchit@gmail.com>
Co-authored-by: Ananya Maiti <Ananya_Maiti@epam.com>

* Add SITE_PREFIX env variable for site url prefix

* Fix smtp setup for sending verification emails

* Fix conference moderator filter

* Fix template params fro absolute_url and is_proposal_reviewer

* Add Django streamhandler logging with DEBUG (#763)

* Fix proposal comment template parameters

Fix userprofile dashboard url

* Add restart:always to containers

* Fix comment creation error caused sparingly

Add review_comments=False for default comment view for logged in user

* Add password for Redis DB

* Fixes #765

Sort ProposalSection in descending order of creation date
in ProposalSectionReviewer Add form

* Add autocomplete_field for Proposal Reviewer to enable searcheable dropdown in add form

* Update DEFAULT_FROM_EMAIL

* Update common.py

* Added username field in edit profile form (Issue-769) (#771)

Co-authored-by: Rajat Rajdeep <rajat.rajdeep@avasant.com>

* Update Devlopment setup docs (#773)

* Update Devlopment setup docs

* Instructions for setting up junction using Docker post junction upgrade. (#761)

* Added instructions in the ReadMe file for setting up junction using Docker post junction upgrade.

* Updated the psycopg version to resolve - SCRAM authentication requires libpq version 10 issue.

---------

Co-authored-by: Rajat Rajdeep <rajat.rajdeep@avasant.com>

---------

Co-authored-by: Ananya Maiti <Ananya_Maiti@epam.com>
Co-authored-by: Rajat Rajdeep <46029666+RajatRajdeep@users.noreply.github.com>
Co-authored-by: Rajat Rajdeep <rajat.rajdeep@avasant.com>

* Rename travis yml

* Remove status badges from README

---------

Co-authored-by: Bhandari423 <69859505+Bhandari423@users.noreply.github.com>
Co-authored-by: Ananya Maiti <Ananya_Maiti@epam.com>
Co-authored-by: Sanchit Balchandani <balchandani.sanchit@gmail.com>
Co-authored-by: Rajat Rajdeep <46029666+RajatRajdeep@users.noreply.github.com>
Co-authored-by: Rajat Rajdeep <rajat.rajdeep@avasant.com>
  • Loading branch information
6 people committed Jun 15, 2023
1 parent 69afa7a commit c4d8ba3
Show file tree
Hide file tree
Showing 83 changed files with 907 additions and 344 deletions.
50 changes: 50 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# .dockerignore

# Ignore Python bytecode files
__pycache__/
*.pyc
*.pyo
*.pyd

# Ignore virtual environment directories
venv/
*.virtualenv/
.env/

# Ignore Django migration files
*/migrations/*.pyc
*/migrations/__pycache__/

# Ignore logs
logs/
*.log

# Ignore configuration files
*.ini

# Ignore user-specific files (e.g., editor settings)
*.swp
*.swo
*.swn
*.bak
*.tmp
*.sublime*
*.vscode/

# Ignore local media files
media/

# Ignore local database files (SQLite)
*.sqlite3
*.sqlite3-journal

# Ignore test coverage reports
.coverage
htmlcov/

# Ignore build artifacts and distribution files
build/
dist/
*.egg-info/
*.egg
*.wheel
27 changes: 27 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
DEBUG=TRUE
POSTGRES_USER=postgres
POSTGRES_PASSWORD=junction
POSTGRES_DB=junction
HOST_NAME=db
DB_PORT=5432
REDIS_HOST_PASSWORD=password
BROKER_URL=redis://:password@redis:6379/0
CELERY_RESULT_BACKEND=redis://:password@redis:6379/0
SITE_PREFIX=
SITE_NAME=junction
SERVER_PORT=8888
GOOGLE_ANALYTICS_ID=google_analytics_id
FACEBOOK_APP_ID=fb_app_id
EMAIL_HOST_USER=email_host_user
EMAIL_HOST_PASSWORD=email_host_pass
SECRET_KEY=secret_key
GITHUB_CLIENT_ID=github_client_id
GITHUB_CLIENT_SECRET=github_client_secret
GOOGLE_CLIENT_ID=google_oauth_client_id
GOOGLE_CLIENT_SECRET=google_oauth_client_secret
TWITTER_CONSUMER_KEY=twitter_consume_key
TWITTER_CONSUMER_SECRET=twitter_consume_secret
TWITTER_ACCESS_TOKEN_KEY=twitter_access_token
TWITTER_ACCESS_TOKEN_SECRET=twitter_access_token_secret
USE_ASYNC_FOR_EMAIL=boolean
DJANGO_LOG_LEVEL=DEBUG
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@ qr_files/
.vscode/

tmp/

# Env
.env
File renamed without changes.
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3.10-slim-buster

WORKDIR /code

RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
postgresql-client \
build-essential \
nodejs \
npm \
libpq-dev && \
rm -rf /var/lib/apt/lists/*

COPY requirements.txt /code/
RUN pip install --no-cache-dir -r requirements.txt

# Install requirements for running tests
COPY ./tools/requirements-test.txt /code/
RUN pip install --no-cache-dir -r requirements-test.txt

RUN npm install -g yarn
RUN npm install -g grunt-cli

COPY . /code/

RUN chmod +x bin/install-static.sh
RUN bin/install-static.sh
# not getting used at this moment
RUN chmod +x bin/wait-for-it.sh

ENV PYTHONUNBUFFERED=1
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
Junction
---

[![Build Status](https://travis-ci.org/pythonindia/junction.svg)](https://travis-ci.org/pythonindia/junction) [![Coverage Status](https://coveralls.io/repos/pythonindia/junction/badge.svg?branch=master)](https://coveralls.io/r/pythonindia/junction?branch=master) [![Requirements Status](https://requires.io/github/pythonindia/junction/requirements.svg?branch=master)](https://requires.io/github/pythonindia/junction/requirements/?branch=master) [![Documentation Status](https://readthedocs.org/projects/in-junction/badge/?version=latest)](https://in-junction.readthedocs.io/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/in-junction/badge/?version=latest)](https://in-junction.readthedocs.io/en/latest/?badge=latest)

Junction is a software to manage proposals, reviews, schedule, feedback during conference.

Project Setup using Docker
--------------------------

Prerequisites:
1. Docker: You can download and install Docker from the official website at https://www.docker.com/get-started.

Instructions:
1. Copy the .env.sample file to a new .env file by running the following command: ```cp .env.sample .env```
2. Create a local development settings file by running the following command: ```cp settings/dev.py.sample settings/dev.py```
3. Build the junction_local image using the following command: ```docker build -t junction_local .```
4. Start the project by running the following command: ```docker-compose up```
5. Access the application at https://localhost:8888.

Contributing
------------

Expand Down
5 changes: 5 additions & 0 deletions bin/install-static.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
cd junction/static
yarn install
grunt less
cd ../..
17 changes: 17 additions & 0 deletions bin/wait-for-it.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# wait-for-it.sh: Wait for a service to be ready.

set -e

host="$1"
port="$2"
shift 2
cmd="$@"

until PGPASSWORD="$POSTGRES_PASSWORD" psql -h "$host" -U "$POSTGRES_USER" -c '\q'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done

>&2 echo "Postgres is up - executing command"
exec $cmd
46 changes: 46 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3.8'

services:
db:
image: postgres:15-alpine
ports:
- "5432:5432"
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- .env

redis:
image: redis:latest
ports:
- "6379:6379"
restart: always
command: sh -c 'redis-server --requirepass ${REDIS_HOST_PASSWORD}'

web:
image: ananyo2012/junction:1.1
volumes:
- .:/code
ports:
- "${SERVER_PORT}:${SERVER_PORT}"
restart: always
depends_on:
- db
env_file:
- .env
command: sh -c 'python manage.py migrate && python manage.py collectstatic --noinput --clear && gunicorn -c gunicorn.conf.py'

celery:
image: ananyo2012/junction:1.1
depends_on:
- db
- redis
- web
restart: always
env_file:
- .env
command: sh -c 'celery -A junction worker -l info -E'

volumes:
postgres_data:
8 changes: 8 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.8'

services:
test:
build:
context: .
dockerfile: Dockerfile
command: sh -c pytest --cov=unit --cov=integrations --cov-report=html -v
49 changes: 49 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: '3.8'

services:
db:
image: postgres:15-alpine
ports:
- "5432:5432"
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- .env

redis:
image: redis:latest
ports:
- "6379:6379"
restart: always
command: sh -c 'redis-server --requirepass ${REDIS_HOST_PASSWORD}'

web:
build:
context: .
dockerfile: Dockerfile
image: junction_local
volumes:
- .:/code
ports:
- "${SERVER_PORT}:${SERVER_PORT}"
restart: always
depends_on:
- db
env_file:
- .env
command: sh -c 'python manage.py migrate && python manage.py runsslserver 0.0.0.0:${SERVER_PORT}'

celery:
image: junction_local
depends_on:
- db
- redis
- web
restart: always
env_file:
- .env
command: sh -c 'celery -A junction worker -l info -E'

volumes:
postgres_data:
6 changes: 5 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build
ALLSPHINXOPTS = -W -d $(BUILDDIR)/_doctrees/html $(SPHINXOPTS)

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile
.PHONY: help html Makefile

html:
$(SPHINXBUILD) $(ALLSPHINXOPTS) -b html $(SOURCEDIR) $(BUILDDIR)/html

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down

0 comments on commit c4d8ba3

Please sign in to comment.