Coder Social home page Coder Social logo

toferc / epi_center Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 2.0 1.74 MB

GraphQL API for people data

Dockerfile 0.40% Procfile 0.02% PLpgSQL 0.24% Rust 64.28% HTML 5.55% Jupyter Notebook 23.67% Slim 0.36% JavaScript 3.34% TypeScript 2.05% CSS 0.08%

epi_center's Introduction

People Data Analytics

This app is a learning project and attempt to create a data-centric model and Graphql API of employee skills, capabilities, certifications and work over time.

  • Model people and their roles on teams
  • Model people's skills and validate them based on their work
  • Model how teams fit into an org hierarchy
  • Model organizational capacity and work in progress
  • Time-series modelling of changes to the organization over time as people change roles, learn and evolve.

It also includes :

  • User models
  • Automated Admin Generation
  • Authentication and sign-in

Dependencies

  • Diesel-cli

Setup

  • Clone the repository
  • Create .env file with the following environmental variables:
    • DATABASE_URL=postgres://christopherallison:12345@localhost/people_data_api?sslmode=disable
    • SECRET_KEY=32CHARSECRETKEY
    • PASSWORD_SECRET_KEY=32CHARSECRETKEY
    • JWT_SECRET_KEY=32CHARSECRETKEY
    • ADMIN_EMAIL=[email protected]
    • ADMIN_PASSWORD=ADMINPASSWORD
    • ADMIN_NAME="Admin Name"
  • Change APP_NAME const in lib.rs to your app
  • diesel migration run
  • cargo run

Dan's notes

Running on MacOS

cargo install diesel_cli --no-default-features --features postgres # if not already installed

# MacOS only clean up when done
brew install libpq
brew link --force libpq

cargo clean

docker compose down; sleep 2; docker compose up -d db; sleep 10; diesel migration run
docker compose exec -it db psql -U christopherallison -W people_data_api
docker compose logs -f

time docker compose build people-data-api
docker images | grep epi
docker compose up

WiP/TODO

  • Working: Dockerfile.simple again: worked (arm64:4.25GB)

  • Working: Dockerfile.slim finally working with base rust-image (arm64:1.98GB)

  • Working: Dockerfile.slim try debian:buster (arm64:444MB)

  • Working: Dockerfile.slim try debian:buster-slim : (arm64:392MB amd64:447MB )

  • Try again on codespaces (amd64)

    • Rename Dockerfile.slim to Dockerfile.slim
  • Docker as non root user (rusty)

  • Can I just copy src and Cargo.(toml|lock) into the image?

    • If so, Fix Dockerfile.simple as well
    • If so, remove the .dockerignore file
  • Accelerate build with rust crate cache?

  • Re-validate all dependencies in Dockerfile.slim

  • alpine base image (musl)

  • http response type for index.html Content-Type: text/html; charset=UTF-8

  • replace openssl with libssl-dev in Dockerfile.simple

  • Add e2e tests

  • progress indication with logging function

  • Where shall we run diesel migrations?

Container image sizes

You can control the image you build by selecting the Dockerfile.XX in the docker-compose.yml file.

Image arm64 amd64 description
rust:1.68 4.25GB single stage (Dockerfile.simple)
rust:1.68 1.98GB multi-stage
debian:buster 444MB multi-stage
debian:buster-slim 392MB 447MB (15 minutes build) multi-stage (Dockerfile.slim)
alpine:3.14 multi-stage musl based (Dockerfile.alpine)

Caching the build

To enable the caching of the compiling of the rust dependencies, you can modify the start of the Dockerfile.slim to add this:

SNIPPET

measured on M2 Mac Mini:

Image first subsequent with only code change description
Dockerfile.simple 238s single stage
Dockerfile.slim 216s multi-stage
Dockerfile.fast multi-stage

epi_center's People

Contributors

toferc avatar daneroo avatar lucbelliveau avatar

Stargazers

Tim Allardyce avatar Keith avatar Thomk avatar

Watchers

 avatar

epi_center's Issues

Fix Bug with Team -> Owner

'''thread 'actix-rt|system:0|arbiter:9' panicked at 'called Result::unwrap() on an Err value: Error { message: "Record not found", extensions: None }', src/models/team.rs:155:70'''

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.