Git Product home page Git Product logo

vlusk's Introduction

vlusk-primer

Simple fullstack and monorepo PoC for data visualization, using Python/Flask, Node/Vue.js and Postgres, deployed as containers handling backend, frontend and database. Test it locally with docker-compose/k3s, running the individual container images or via scripts.

container images at hub.

Featuring:

  • Backend:Python/Flask
    • Session-Cookie Authentication: flask_login
    • PyJWT
  • Frontend: Node/Vue.js
  • Database ORM: SQLAlchemy
    • postgres for dataframe storage
    • sqlite3 for session cache [?]

Frontend

manually running the process

Scaffolding generated with [email protected]:

; npm create [email protected] frontend/ -- --template vue-ts
;
; npm install [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
;
; npm install -D '@types/node'
;
; npm run dev

Database

run it as a standalone container so instances of postgres aren't polluted

Run the container process with the database

podman run -it -p=5432:5432 --name dbdrop -d \
    -e POSTGRES_USER=admin \
    -e POSTGRES_PASSWORD=Passw0rd \
    -v /mnt/ssd/dataStore/containers/database/pgad-pod/pgdata:/var/lib/postgresql/data:Z \
    docker.io/library/postgres:16.0

Connect psql to the process, create the schema and populate the database. The loop below reads all files under the database directory in alphanumeric order, so you can always tell that the reading respects precedence.

# Create schema with Raw SQL script then populate the database
#psql -U admin -d database_name -f=file.sql

for f in *.sql;
do
    psql -U admin -d dbdrop -f "$f"
done

Backend

manually running the process

Make sure to set the virtualenv:

; git clone [email protected]:isi23drop/vlusk-primer.git
; python3 -m venv venv

Prepare the environment:

; cd ./vlusk/backend/
; source ../venv/bin/activate
; pip3 install --upgrade pip
; pip3 install -r ./requirements.txt

Now that all dependencies are installed, just run each process from a different terminal:

  1. database migration
flask --app app init-db
  1. PS: now in flask 3.0 the FLASK_ENV is deprecated alongside the debug mode that goes back to the framework on the CLI call, hence the flag "--debug".
cd ./app/
flask --debug run

Deployments

Podman Service and DOCKER_HOST

compose concentrates in orchestrating multiple containers in a single host. To do this with k8s, you would need kind, k3s (does not use virtualization) or similar. It was made to be compatible with other OCI runtimes, such as Podman, which was one of the first to enable rootless containers, and can be setup with compose using the Podman Service's systemd unit file for unix sockets.

The orchestration tool docker-compose supports Podman Service through the DOCKER_HOST environment variable. This makes it possible to run containers with podman but with the benefit of rootless.

Source the script and run it to run compose with podman:

; source ./scripts/podman-service-compose.sh

Running with the podman-compose script

Running with k8s

Kubernetes is a container orchestrator. To run this project on single host just like the Compose tool, you can use tools like kind or k3s (which don't use virtualization).

vlusk's People

Contributors

deomorxsy 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.