Loading .gitlab-ci.yml 0 → 100644 +28 −0 Original line number Diff line number Diff line # This file is a template, and might need editing before it works on your project. # Official framework image. Look for the different tagged releases at: # https://hub.docker.com/r/library/python image: python:latest # This folder is cached between builds # http://docs.gitlab.com/ce/ci/yaml/README.html#cache cache: paths: - ~/.cache/pip/ stages: - build build: stage: build tags: - shared-fi before_script: - python -V # Print out python version for debugging - pip install pipenv script: - pipenv install --dev - pipenv run coverage run --branch --source=portal -m pytest docs/Configuration.adoc +25 −2 Original line number Diff line number Diff line Loading @@ -8,13 +8,36 @@ Default environment configuration is stored in a `portal/config.py` file. To override the defaults, you should edit a custom configuration file ``portal.local.cfg`` and place it in the project ROOT. You can take a look at `example-portal.local.cfg` in the `docs` folder == Variables File is logically split into multiple sections. Each variable should have some short expectation with example. == Features configuration In this section there will be some documentation to configure additional features === Emails - To test emails on the `localhost` without mail server you can use link:https://github.com/mailhog/MailHog[MailHog] - Best way to use it, is to use the Docker: [source,bash] ---- docker pull mailhog/mailhog docker run -d \ --restart unless-stopped \ --name mailhog \ -p 1025:1025 \ -p 8025:8025 \ mailhog/mailhog ---- - This will create you an MailHog instance, on your `localhost` - Web UI: `http://localhost:8025/` - SMTP port: `1025` - There is no additional security, no username and password Loading docs/Demo.adoc 0 → 100644 +70 −0 Original line number Diff line number Diff line = Simple demo installation and run This is simple out of the box demo installation. == Global prerequisites * Python 3.6 or higher * https://github.com/pypa/pipenv[Pipenv] == Checkout and install dependencies Checkout the repository and install all the dependencies [source,bash] ---- git clone https://gitlab.fi.muni.cz/grp-kontr2/portal pipenv install # installs dependencies ---- == Set all the config variables as desired Go to `portal.local.cfg` in the project root and edit the configuration variables. === FEATURE: EMAILS To test the emails on the `localhost` without mail server you can use link:https://github.com/mailhog/MailHog[MailHog] Best way is to use the Docker: [source,bash] ---- docker pull mailhog/mailhog docker run -d \ --restart unless-stopped \ --name mailhog \ -p 1025:1025 \ -p 8025:8025 \ mailhog/mailhog ---- This will create you an MailHog instance, on your `localhost` - Web UI: `http://localhost:8025/` - SMTP port: `1025` - There is no additional security, no username and password === Run the backend To run the backend there are some steps required: - Set the flask app env variable: [source, bash] ---- export FLASK_APP='run.py' ---- - Run the migrations [source, bash] ---- flask db upgrade ---- - Initialize the data (users) ---- flask init_data admin ---- docs/example-portal.local.cfgdeleted 100644 → 0 +0 −80 Original line number Diff line number Diff line # # FEATURES # # If enabled, the OAuth using gitlab will be enabled KONTR_FEAT_GITLAB = True # If enabled, the backend will be sending emails KONTR_FEAT_EMAILS = True # If enabled, kontr API support will be enabled KONTR_FEAT_IS_API = True # # Gitlab specific configuration # # Gitlab base url GITLAB_URL = "https://gitlab.fi.muni.cz/" # Gitlab Client ID GITLAB_CLIENT_ID = "12346" # Gitlab Client Secret GITLAB_CLIENT_SECRET = "123456" # Redirect url after received the gitlab token FRONTEND_URL = "http://kontr.pstanko.net/gitlabLogin" # # STORAGE # # Base location for kontr storage KONTR_STORAGE_BASE_DIR = "/tmp/storage" # Location where test files should be stored KONTR_STORAGE_TEST_FILES_DIR = f"{KONTR_STORAGE_BASE_DIR}/test-files" # Location where workspace is stored KONTR_STORAGE_WORKSPACE_DIR = f"{KONTR_STORAGE_BASE_DIR}/workspace" # Location where submissions should be stored KONTR_STORAGE_SUBMISSIONS_DIR = f"{KONTR_STORAGE_BASE_DIR}/submissions" # # DATABASE # # for more info: http://flask-sqlalchemy.pocoo.org/2.3/config/ # URI to connect to the database # if 'sqlite://' - the in memory database will be used SQLALCHEMY_DATABASE_URI = "sqlite://" #SQLALCHEMY_ECHO=False #SQLALCHEMY_RECORD_QUERIES # # JWT # # for more info: https://pythonhosted.org/Flask-JWT/ JWT_SECRET_KEY = "" JWT_EXPIRATION_DELTA=6000 # JWT_VERIFY=True # # FLASK # SECRET_KEY = "" # # Emails specific configuration # # for more info https://pythonhosted.org/Flask-Mail/ MAIL_SERVER = "localhost" MAIL_PORT = "25" MAIL_DEBUG = "" MAIL_USERNAME = None MAIL_PASSWORD = None MAIL_DEFAULT_SENDER = "" MAIL_SUPPRESS_SEND = "" MAIL_ASCII_ATTACHMENTS = False MAIL_USE_TLS = False MAIL_USE_SSL = False MAIL_MAX_EMAILS = None No newline at end of file Loading
.gitlab-ci.yml 0 → 100644 +28 −0 Original line number Diff line number Diff line # This file is a template, and might need editing before it works on your project. # Official framework image. Look for the different tagged releases at: # https://hub.docker.com/r/library/python image: python:latest # This folder is cached between builds # http://docs.gitlab.com/ce/ci/yaml/README.html#cache cache: paths: - ~/.cache/pip/ stages: - build build: stage: build tags: - shared-fi before_script: - python -V # Print out python version for debugging - pip install pipenv script: - pipenv install --dev - pipenv run coverage run --branch --source=portal -m pytest
docs/Configuration.adoc +25 −2 Original line number Diff line number Diff line Loading @@ -8,13 +8,36 @@ Default environment configuration is stored in a `portal/config.py` file. To override the defaults, you should edit a custom configuration file ``portal.local.cfg`` and place it in the project ROOT. You can take a look at `example-portal.local.cfg` in the `docs` folder == Variables File is logically split into multiple sections. Each variable should have some short expectation with example. == Features configuration In this section there will be some documentation to configure additional features === Emails - To test emails on the `localhost` without mail server you can use link:https://github.com/mailhog/MailHog[MailHog] - Best way to use it, is to use the Docker: [source,bash] ---- docker pull mailhog/mailhog docker run -d \ --restart unless-stopped \ --name mailhog \ -p 1025:1025 \ -p 8025:8025 \ mailhog/mailhog ---- - This will create you an MailHog instance, on your `localhost` - Web UI: `http://localhost:8025/` - SMTP port: `1025` - There is no additional security, no username and password Loading
docs/Demo.adoc 0 → 100644 +70 −0 Original line number Diff line number Diff line = Simple demo installation and run This is simple out of the box demo installation. == Global prerequisites * Python 3.6 or higher * https://github.com/pypa/pipenv[Pipenv] == Checkout and install dependencies Checkout the repository and install all the dependencies [source,bash] ---- git clone https://gitlab.fi.muni.cz/grp-kontr2/portal pipenv install # installs dependencies ---- == Set all the config variables as desired Go to `portal.local.cfg` in the project root and edit the configuration variables. === FEATURE: EMAILS To test the emails on the `localhost` without mail server you can use link:https://github.com/mailhog/MailHog[MailHog] Best way is to use the Docker: [source,bash] ---- docker pull mailhog/mailhog docker run -d \ --restart unless-stopped \ --name mailhog \ -p 1025:1025 \ -p 8025:8025 \ mailhog/mailhog ---- This will create you an MailHog instance, on your `localhost` - Web UI: `http://localhost:8025/` - SMTP port: `1025` - There is no additional security, no username and password === Run the backend To run the backend there are some steps required: - Set the flask app env variable: [source, bash] ---- export FLASK_APP='run.py' ---- - Run the migrations [source, bash] ---- flask db upgrade ---- - Initialize the data (users) ---- flask init_data admin ----
docs/example-portal.local.cfgdeleted 100644 → 0 +0 −80 Original line number Diff line number Diff line # # FEATURES # # If enabled, the OAuth using gitlab will be enabled KONTR_FEAT_GITLAB = True # If enabled, the backend will be sending emails KONTR_FEAT_EMAILS = True # If enabled, kontr API support will be enabled KONTR_FEAT_IS_API = True # # Gitlab specific configuration # # Gitlab base url GITLAB_URL = "https://gitlab.fi.muni.cz/" # Gitlab Client ID GITLAB_CLIENT_ID = "12346" # Gitlab Client Secret GITLAB_CLIENT_SECRET = "123456" # Redirect url after received the gitlab token FRONTEND_URL = "http://kontr.pstanko.net/gitlabLogin" # # STORAGE # # Base location for kontr storage KONTR_STORAGE_BASE_DIR = "/tmp/storage" # Location where test files should be stored KONTR_STORAGE_TEST_FILES_DIR = f"{KONTR_STORAGE_BASE_DIR}/test-files" # Location where workspace is stored KONTR_STORAGE_WORKSPACE_DIR = f"{KONTR_STORAGE_BASE_DIR}/workspace" # Location where submissions should be stored KONTR_STORAGE_SUBMISSIONS_DIR = f"{KONTR_STORAGE_BASE_DIR}/submissions" # # DATABASE # # for more info: http://flask-sqlalchemy.pocoo.org/2.3/config/ # URI to connect to the database # if 'sqlite://' - the in memory database will be used SQLALCHEMY_DATABASE_URI = "sqlite://" #SQLALCHEMY_ECHO=False #SQLALCHEMY_RECORD_QUERIES # # JWT # # for more info: https://pythonhosted.org/Flask-JWT/ JWT_SECRET_KEY = "" JWT_EXPIRATION_DELTA=6000 # JWT_VERIFY=True # # FLASK # SECRET_KEY = "" # # Emails specific configuration # # for more info https://pythonhosted.org/Flask-Mail/ MAIL_SERVER = "localhost" MAIL_PORT = "25" MAIL_DEBUG = "" MAIL_USERNAME = None MAIL_PASSWORD = None MAIL_DEFAULT_SENDER = "" MAIL_SUPPRESS_SEND = "" MAIL_ASCII_ATTACHMENTS = False MAIL_USE_TLS = False MAIL_USE_SSL = False MAIL_MAX_EMAILS = None No newline at end of file