Skip to content

Commit

Permalink
Update Devlopment setup docs (#773)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
4 people authored Jun 14, 2023
1 parent abcff23 commit e08f527
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 77 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ Junction

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
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
104 changes: 30 additions & 74 deletions docs/source/development/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,109 +12,66 @@ this process, please `open an issue`_ about it on the issue tracker.
Initial Setup
=============

Junction's development workflow is automated using `nox`_. Thus, you need
the ``nox`` command to be installed on your system. We recommend using ``pipx``
to install ``nox`` in its own isolated environment.
Junction's development workflow is automated using Docker with docker-compose.
We also use Docker for production deployment.

.. code-block:: console
$ python -m pip install pipx
$ pipx install nox
To setup Docker and docker-compose locally follow the `Docker Getting started`_ doc.

You will need to have a working Redis server on your system. You may
additionally want to install Postgres, although it is optional.
After Docker and docker-compose is setup locally follow these steps

.. note::
.. code-block:: console
On Debian based systems, these can be installed using:
$ cp .env.sample .env
$ docker-compose build
$ docker-compose up -d
.. code-block:: console
This will build and run the application after running database migrations

$ sudo apt install redis-server postgres
Access the application at https://localhost:8888

Backend
-------

Create a "settings" file for local development with Django.

.. code-block:: console
$ cp settings/dev.py.sample settings/dev.py
--------

Create the database structure and populate it with sample data.
Populate Database with sample data

.. code-block:: console
$ nox -- migrate --noinput
$ nox -- sample_data
$ docker-compose exec web /bin/sh
# python manage.py sample_data
Admin Access
^^^^^^^^^^^^

When sample data is generated with ``nox -- sample_data``, a superuser is
created with the username ``admin`` and password ``123123``.
When sample data is generated, a superuser is created with the username ``admin`` and password ``123123``.
Go to https://localhost:8888/nimda to access Django Admin Panel


Frontend
--------

Working on Junction's frontend requires `NodeJS`_ and `yarn`_ to be installed on your
system. The frontend is built using `grunt`_. To setup the working
environment, run the following:

.. code-block:: console
$ cd junction/static
$ yarn install
Development workflow
====================

Frontend Autobuilding
---------------------

Junction has a Grunt configuration that is useful when working on the frontend.
The following command starts a build watcher which rebuilds the frontend on
every file change.

.. code-block:: console
$ grunt
For ease of development ``app.css`` is checked in to the source code. It is not
recommended to directly make changes to ``app.css``, rather update the less files
and run ``grunt``, then commit ``app.css``

Invoking ``manage.py``
----------------------

Junction's ``nox`` configuration is set up to invoke manage.py when no other
session (i.e. ``-s ...``) is specified. This also automatically sets up an
isolated environment that contains the dependencies of Junction.

.. code-block:: console
$ nox # equivalent to 'python manage.py'
$ nox -- runserver # equivalent to 'python manage.py runserver'
$ nox -- migrate # equivalent to 'python manage.py migrate'
Running tests
-------------

For running the tests, run:

.. code-block:: console
$ nox -s test
$ docker-compose -f docker-compose.test.yml up -d
Running linters
---------------

For running the linters, run:
We use `pre-commit`_ for linting. Install pre-commit then run:

.. code-block:: console
$ pre-commit install
This will install all linters in form of git hooks. To manually run the linter run:

.. code-block:: console
$ nox -s lint
$ pre-commit run --all-files
Building documentation
----------------------
Expand All @@ -123,11 +80,10 @@ For building the documentation, run:

.. code-block:: console
$ nox -s docs
$ python -m pip install -r tools/requirements-docs.txt
$ cd docs
$ make html
.. _`open an issue`: https://github.com/pythonindia/junction/issues
.. _`virtualenv`: https://virtualenv.pypa.io/en/stable/
.. _`nox`: https://nox.readthedocs.io/en/stable/
.. _`NodeJS`: https://nodejs.org/
.. _`yarn`: https://yarnpkg.com/
.. _`grunt`: https://gruntjs.com/
.. _`Docker Getting started`: https://www.docker.com/get-started
.. _`pre-commit`: https://pre-commit.com/
2 changes: 2 additions & 0 deletions docs/source/development/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ development, testing, and documentation.
:maxdepth: 2

getting-started

nox-setup
130 changes: 130 additions & 0 deletions docs/source/development/nox-setup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
==========================
Development Setup with nox
==========================

**Note**: `nox`_ is the older way of setting up development environment. This section is stale.
If you find *nox* helpful consider updating this section


Initial Setup
=============

Junction's development workflow is automated using `nox`_. Thus, you need
the ``nox`` command to be installed on your system. We recommend using ``pipx``
to install ``nox`` in its own isolated environment.

.. code-block:: console
$ python -m pip install pipx
$ pipx install nox
You will need to have a working Redis server on your system. You may
additionally want to install Postgres, although it is optional.

.. note::

On Debian based systems, these can be installed using:

.. code-block:: console
$ sudo apt install redis-server postgres
Backend
-------

Create a "settings" file for local development with Django.

.. code-block:: console
$ cp settings/dev.py.sample settings/dev.py
Create the database structure and populate it with sample data.

.. code-block:: console
$ nox -- migrate --noinput
$ nox -- sample_data
Admin Access
^^^^^^^^^^^^

When sample data is generated with ``nox -- sample_data``, a superuser is
created with the username ``admin`` and password ``123123``.


Frontend
--------

Working on Junction's frontend requires `NodeJS`_ and `yarn`_ to be installed on your
system. The frontend is built using `grunt`_. To setup the working
environment, run the following:

.. code-block:: console
$ cd junction/static
$ yarn install
Development workflow
====================

Frontend Autobuilding
---------------------

Junction has a Grunt configuration that is useful when working on the frontend.
The following command starts a build watcher which rebuilds the frontend on
every file change.

.. code-block:: console
$ grunt
For ease of development ``app.css`` is checked in to the source code. It is not
recommended to directly make changes to ``app.css``, rather update the less files
and run ``grunt``, then commit ``app.css``

Invoking ``manage.py``
----------------------

Junction's ``nox`` configuration is set up to invoke manage.py when no other
session (i.e. ``-s ...``) is specified. This also automatically sets up an
isolated environment that contains the dependencies of Junction.

.. code-block:: console
$ nox # equivalent to 'python manage.py'
$ nox -- runserver # equivalent to 'python manage.py runserver'
$ nox -- migrate # equivalent to 'python manage.py migrate'
Running tests
-------------

For running the tests, run:

.. code-block:: console
$ nox -s test
Running linters
---------------

For running the linters, run:

.. code-block:: console
$ nox -s lint
Building documentation
----------------------

For building the documentation, run:

.. code-block:: console
$ nox -s docs
.. _`open an issue`: https://github.com/pythonindia/junction/issues
.. _`virtualenv`: https://virtualenv.pypa.io/en/stable/
.. _`nox`: https://nox.readthedocs.io/en/stable/
.. _`NodeJS`: https://nodejs.org/
.. _`yarn`: https://yarnpkg.com/
.. _`grunt`: https://gruntjs.com/
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ django-filter==22.1

# Persistent Store
# -------------------------------------------------
psycopg2-binary==2.9.5
psycopg2-binary==2.9.6
redis==4.3.4
dj-database-url==0.5.0

Expand Down
2 changes: 1 addition & 1 deletion tools/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx==2.4.4
sphinx==7.0.1
recommonmark==0.6.0

0 comments on commit e08f527

Please sign in to comment.