nkorobkov / lfmsh_bank

A full-sized web accounts management system to support the virtual economy.
htpps://nkorobkov.com/projects/bank
9 stars 5 forks source link
banking-applications bootstrap django docker-compose finance nginx python3

Bank SPMS

Build Status

Bank is a web application that hosts individual accounts of more than 130 users with different permissions. It allows the users to issue and transfer money, living within the virtual economic system of the Summer Physical and Mathematical School.

A more detailed description of the project, architecture and technologies used can be found at the Bank Project Description Page

Installation and running

Before any installation, you'll need to clone the repo and install the requirements. You may want to use a virtual environment for this process. Here are example steps to do that:

> python3 -m venv venv
> source venv/bin/activate
> pip3 install -r requirements.txt

Run cp .env.template .env to create .env file with configurations. Update secret values accordingly (especially if you are planning to deploy).

Local startup instructions

Local testing

cd django-app
python ./manage.py test

Building with docker

Build an image for local hosting with: docker build -t django-bank:0.01 -f ./docker/django-app/Dockerfile . and then run it with: docker run -d -p 1234:8000 django-bank:0.01

You can check that the bank is working at http://127.0.0.1:1234/bank/.

This approach requires you to make migrations and populate tables in advance, before constructing an image. Alternatively, if image is already constructed, you can log in into running container with
docker exec -it <YOUR_CONTAINER_ID> /bin/bash and exec all the commands needed to populate database from local startup section above. All the changes in db would be lost after container restart unless you commit them to image.

Docker Compose

Alternatively, there is a possibility to launch lfmsh bank in production-like mode with a real server and db.

docker-compose.yml file contains configuration for deployment of following schema:

Run docker-compose up from root of the project (where docker-compose.yml is located) to see the application start up with postgres db, nginx server and django app, all in separate containers. All postgres data would be stored in docker/postgres/volumes and would persist upon the container restart.

After the first startup, you will still need to populate tables manually. Log in to uwsgi container: docker exec -it lfmsh_bank_uwsgi_1 /bin/bash and run migrations and static data operations from local startup section above.

In the current configuration, static data is not stored on GitHub. To download it, you'll still need to collectstatic manually. Run ./django-app/manage.py collectstatic from the host machine, and the nginx container will gain access to this data automatically.

After these two operations (static collection and db population), bank would be avaliable at http://localhost/bank You'll be able to toggle bank on and off with single docker-compose up/down command.

History

This is the second version of Bank application. Version 1 was developed in 2016 and is hosted in another repo here.