jenngeorge / bikeshare-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Current Status:

  • goal: adding Flask & Postgres to Docker, set up database
    • flask is the api
    • postgres holds all the station data in 2 tables: stations and station_changes
  • currently:
    • making requests to flask api from consumer
    • add station history update requests to station add & update
    • create a testintegration service

Resources Used:

Helpful Docker commands:

  • docker-compose up, docker-compose down
    • e.g. docker-compose up -d --build
  • docker-compose ps: prints status of services
  • docker-compose logs
  • 'docker inspect web | grep "IPAddress"': gets container ip address
  • docker system prune -a use this or run out of storage
  • docker-compose run <service-name> bash
    • bash depends on the container (bash has to exist). some just have bin/sh
    • from within the container, can run commands
    • e.g. docker-compose run web python manage.py seed_db
  • docker-compose exec <service-name> bash
    • get into an already running service
    • e.g. docker exec -it bikeshare-db psql -U postgres
  • if there isn't permission to run something, add chmod
    • chmod +x services/users/entrypoint.sh
  • list containers: docker container ls

Helpful database commands:

  • recreate the dev database: docker-compose -f docker-compose.yml \ run web python manage.py recreate_db
  • get into psql: docker exec -ti $(docker ps -aqf "name=bikeshare-db") psql -U postgres
  • run flask tests docker-compose -f docker-compose.yml run web python manage.py test

Helpful flask:

Tips from friends / the internet:

  • AWS

    • look at elastic beanstalk or elastic containers
    • it will take patience
    • look into circleci
    • S3 is for static assets
    • use RDS for db
  • might want a docker-compose.prod

    • because there could be a different dev database
    • use env variables in docker-compose

About


Languages

Language:Python 91.2%Language:Dockerfile 8.8%