Unverified Commit fb0b00f7 authored by Peter Stanko's avatar Peter Stanko
Browse files

Updated readme to run the development version of the portal

parent 452839e8
Pipeline #13157 failed with stage
in 3 minutes and 52 seconds
......@@ -4,29 +4,138 @@ Kontr portal backend
image:https://gitlab.fi.muni.cz/grp-kontr2/portal/badges/master/pipeline.svg[link="https://gitlab.fi.muni.cz/grp-kontr2/portal/commits/master",title="pipeline status"]
== Documentation
More complex documentation you can find link:https://gitlab.fi.muni.cz/grp-kontr2/kontr-documentation[here]
== Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
See documentation for notes on how to deploy the project on a live system.
== Installation
Take a look at the installation document `docs/Installation.adoc`
Also take a look at the demo document `docs/demo.adoc`
Here are simple instructions how to download and run the server. You need Python 3.6.
==== Checkout the portal project
Checkout the portal.
[source, shell]
----
$ git clone https://gitlab.fi.muni.cz/grp-kontr2/portal
----
==== Install dependencies
You need to install link:https://www.python-ldap.org/en/latest/installing.html[python-ldap], postgres development and python dev dependencies.
===== Alpine linux:
[source, shell]
----
$ apk add --update --no-cache g++ gcc libxslt-dev postgresql-dev postgresql-libs openldap-dev python3-dev
----
===== Debian:
[source, shell]
----
$ apt install ldap-utils ldapscripts libldap2-dev libsasl2-dev
----
==== Install Python dependencies
If you need to run the tests, you need to call `pipenv install` with `--dev` option.
[source, shell]
----
$ pipenv install --dev
----
== Running the tests
- To run the test you need to run:
To run the test you need to run:
[source, bash]
----
pipenv run coverage run -m pytest
$ pipenv run coverage run -m pytest
----
== Deployment
== Development Deployment
=== Deploy postgres
For manual deployment you need to have deployed database - for example postgres.
**Docker instance:**
[source, shell]
----
$ docker run -d --name pgdb -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres postgres:latest
----
- Take a look at the installation document `docs/Installation.adoc` ->
Docker and Docker compose section
=== Deploy redis
You need redis as message broker for the celery.
[source, shell]
----
$ docker run --rm --name some-redis -p 6379:6379 -d redis redis-server
----
=== Configure the Portal
You can use the `ENV` variables or configure it using the `portal.local.cfg` or `portal/config.py`.
Here are some important variables:
- `SQLALCHEMY_DATABASE_URI` - Database uri for SQLAlchemy (example: `postgresql://postgres:postgres@localhost:5432/postgres`)
- `JWT_SECRET_KEY` - Key to be used to encrypt the `access_code` for authentication
- `PORTAL_STORAGE_BASE_DIR` - Storage base dir - where to store all the files (examle: `/tmp/portal/storage`)
- `GITLAB_URL` - Url to Gitlab instance
- `GITLAB_CLIENT_ID` - Gitlab client id
- `GITLAB_CLIENT_SECRET` - Client secret
- `FRONTEND_URL` - Where to redirect after gitlab login was successfull
- `EMAIL_HOST` - Where is running the mail server
- `EMAIL_PORT` - Port on which the mail server is running
- `EMAIL_DEFAULT_FROM` - From who the emails are
For more take a look at the config files.
==== Init the portal
Initialize the portal database and data
[source, shell]
----
$ flask db upgrde
$ flask data init 'dev'
$ flask users create admin --password '<your_password>'
----
==== Run the celery worker
Run the async worker
[source, shell]
----
$ celery -A app.celery worker
----
==== Run the flask server - API
Run the flask API server.
[source, shell]
----
$ flask run -p 8000
----
== Contributing
......@@ -36,8 +145,10 @@ and the process for submitting pull requests to us.
== Authors
* *Barbora Kompisova* - _Initial work_ - https://gitlab.fi.muni.cz/xkompis[xkompis]
* *Barbora Kompišová* - _Initial work_ - https://gitlab.fi.muni.cz/xkompis[xkompis]
* *Peter Stanko*
* *Matej Dujava*
* *Kristýna Pekarková*
== Acknowledgments
......
......@@ -39,7 +39,7 @@ FRONTEND_URL = "http://kontr.pstanko.net/gitlabLogin"
# URI to connect to the database
# if 'sqlite://' - the in memory database will be used
#SQLALCHEMY_DATABASE_URI = f"sqlite:////{ROOT_DIR}/devel.db"
SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:postgres@localhost:5432/postgres"
SQLALCHEMY_DATABASE_URI = "postgresql://postgres:postgres@localhost:5432/postgres"
#SQLALCHEMY_ECHO=False
#SQLALCHEMY_RECORD_QUERIES
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment