Skip to content

teloniusz/masserfront

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MasserFront

MasserFront is a React and Flask-based UI application for Masserstein mass spectrometry result analysis.

Installation

  1. Clone the repository with submodules
git clone https://gitlab.mimuw.edu.pl/ag181044/masserfront.git --recurse-submodules
cd masserfront/
  1. Initialize the default SQLite database
./ctl flask db upgrade

Usage

To run a development server:

$ ./ctl run
INFO:runlib:Calling command: run with args: 
...
INFO:app.classes:Registering blueprint: base
 * Serving Flask app 'app'
 * Debug mode: off
INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
INFO:werkzeug:Press CTRL+C to quit

To run a server on a specified host/port:

$ ./ctl run --host 0.0.0.0 -p 18000
INFO:runlib:Calling command: run with args: host: '0.0.0.0' port: '18000'
...

To start a uWSGI server with a HTTP interface:

$ ./ctl uwsgi start -s 0.0.0.0:18000
INFO:runlib:Calling command: uwsgi with args: start socket: '0.0.0.0:18000' plugin: 'python3'
[uWSGI] getting INI configuration from config.ini
INFO:runlib:UWSGI process started and daemonized

Logfile can be found in ./var/log/uwsgi.log.

To start a uWSGI server with Unix domain socket interface (for proxying from Apache, nginx or other HTTP server with uWSGI support):

$ ./ctl uwsgi start -s /path/to/socker
INFO:runlib:Calling command: uwsgi with args: start socket: '0.0.0.0:18000' plugin: 'python3'
[uWSGI] getting INI configuration from config.ini
INFO:runlib:UWSGI process started and daemonized

To stop uWSGI server:

$ ./ctl uwsgi stop
INFO:runlib:Calling command: uwsgi with args: stop
INFO:runlib:UWSGI process stopped

To run a development docker compose (with app/ and web/ bind-mounted inside, requires updating web/node_modules by npm ci/npm i run in web/):

docker compose -f docker-compose.yml -f docker-compose.dev.yml up

To run production docker instances:

docker compose up

Last two calls may require adding a --build option or running docker builder prune to get rid of build cache if significant changes were introduced.

Development

Virtual environment

To add (or upgrade) a pip package:

./ctl env add <package>

To remove a pip package:

./ctl env rm <package>

List env packages:

./ctl env list

To upgrade existing packages (those without version specified):

./ctl env upgrade

To freeze packages at currently installed versions:

./ctl env freeze

To enter virtual env shell:

./ctl env

Flask and database

To execute a flask command:

./ctl flask <command>

To enter Python flask shell with initialized app:

$ ./ctl flask shell
INFO:runlib:Calling command: flask with args: "shell"
(...)
INFO:app.classes:Registering blueprint: base
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
App: app.classes
Instance: /home/students/inf/a/ag181044/projects/masserfront/instance
>>> app
<App 'app.classes'>

To create a migration in migrations/versions/ after changes to a SQLAlchemy Python model:

./ctl flask db migrate

To upgrade database to the newest schema version:

./ctl flask db upgrade

Authors and acknowledgment

Antoni Goldstein Antoni Moszyński

License

GNU General Public License v2

Project status

Production