Giter Club home page Giter Club logo

Planitor

Planning + Monitoring = Planitor

A business intelligence service for people in the planning, property, transport and construction sector in Iceland.

High level

There are two development servers, for bundling frontend and the backend respectively.

Development

Configure .env in the project root

DEBUG=true
MAPKIT_PRIVATE_KEY=
SECRET_KEY=
PROJECT_NAME=Planitor
DOMAIN=planitor.io
EMAILS_FROM_EMAIL=planitor@{{DOMAIN}}
EMAILS_RESET_TOKEN_EXPIRE_HOURS=2
EMAILS_FROM_NAME=Planitor
SMTP_HOST=smtp.mailtrap.io
SMTP_PORT=587
SMTP_TLS=true
SMTP_USER=
SMTP_PASSWORD=
SENTRY_DSN=
IMGIX_TOKEN=

Install dependencies

npm install
poetry install

Use VS Code devcontainer to start the server. Start the devcontainer by opening the top level folder in VS Code. You'll get a prompt to build and start in devcontainer. Open a new shell. It should use Fish. Start a reload webserver on port 80.

uvicorn --reload --reload-dir planitor --host 0.0.0.0 --port 80 planitor.main:app

Run frontend on host machine

npm run start

Preparing deployment

NODE_ENV=production yarn run build  # frontend build
poetry export --without-hashes -f requirements.txt > requirements.txt
poetry export --dev --without-hashes -f requirements.txt > requirements-dev.txt

Then commit this to repo and push to GitHub. Render takes over from there.

DB Migrations

poetry run migrate

This will create a test database based upon the declarative SQLAlchemy schema, then use migra to detect the diff, suggest to run a migration to sync the databases. It shows the SQL migration code which you can copy-paste to tweak.

Run development bpython shell with db object and all models imported

poetry run debug

Render.com specs

  • dramatiq background worker
    • Install: pip install -r requirements.txt
    • Command: dramatiq --processes 1 --threads 4 planitor.actors
  • planitor web service
    • Install: pip install -r requirements.txt && pip install gunicorn
    • Command: gunicorn -w 1 -k uvicorn.workers.UvicornWorker planitor.main:app
    • Domain www.planitor.ioplanitor-us.onrender.com
  • crawl cron job
    • Install: pip install -r requirements.txt && pip install beautifulsoup4 html5lib scrapy
    • Command: scrapy list | xargs -n 1 scrapy crawl
    • Schedule: 0 * * * * (every hour)

planitor's Projects

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.