Giter VIP home page Giter VIP logo

mobashi-main's Introduction

Mobashi-MAIN

Server MAIN of the Mobashi system.

Installation

Configuration for localdev

Only the first time, init Django models and create superuser, running the following commands while inside the running devcontainer:

cd /workspaces/mobashi-main/mobashi-main
../django_init.sh

Configuration for prod

Only the first time, init Django models and create superuser, running the following commands while outside the running devcontainer:

sudo docker compose up -d
sudo docker compose exec mobashi-main /bin/bash
./django_init.sh

Useful commands

Start all the services:

sudo docker compose up -d

Opn a shell into running container for "mobashi-main" service:

sudo docker compose exec mobashi-main /bin/bash

Crypto

The package:

https://github.com/incuna/django-pgcrypto-fields

allows you to encrypt fields in the PostgreSQL database transparently.

When you perform the first migrate, the package itself adds support for pgcrypto to the database, executing the following SQL statement:

create extension pgcrypto;

However, the package only works with the Public/Private key system and only if a passphrase has not been set to protect the secret key itself.

The two key files must be put inside the secrets/django/[localdev|prod]/ directory as public.key and private.key respectively, so that they end up mounted inside the container as:

 server/django_secrets/public.key
 server/django_secrets/private.key

For example they can be generated as described below.

Check the installed version of gpg is 2.x:

gpg --version

Generate the keys using one the following command:

gpg --full-generate-key

with the following settings:

Please select what kind of key you want: [RESPOND 2]
What keysize do you want? [RESPOND 2048]
Key is valid for? [RESPOND 0]
Real name: [RESPOND mobashimain]
Email address: [RESPOND [email protected]]
You need a Passphrase to protect your secret key. [DO NOT ENTER ANY PASSPHRASE!!!]

WARNING!!! If gpg remains stuck on generating random bytes, it is necessary to open another terminal and perform operations that engage the disk, or download files from the Internet, otherwise it may take several minutes before enough random values are available to generate the keys!!!

Export the public key, specifying the email address used earlier:

gpg -a --export [email protected] > secrets/django/[localdev|prod]/public.key

Get the identifier of the private key:

gpg --list-secret-keys

/home/prizzi/.gnupg/pubring.kbx
-------------------------------
sec   dsa2048 2020-03-09 [SC]
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid           [ultimate] mobashimain <[email protected]>
ssb   elg2048 2020-03-09 [E]

The value on the second line of sec (Ex: XXXXX) is the identifier of the private key.

Export the private key, specifying its identifier:

gpg -a --export-secret-keys <ID_PRIVATE> > secrets/django/[localdev|prod]/private.key

mobashi-main's People

Contributors

caipirginka avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.