Skip to content

padamson/phicite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhiCite

Extract and cite machine-readable knowledge in documents on the web

CI/CD

If starting from scratch...to build, generate database migrations, test, and check (with ruff) locally:

docker compose up -d --build
docker compose exec web aerich init-db
docker compose exec web python -m pytest # --cov="."  --cov-report html
docker compose exec web ruff check . # or ruff check --fix .

To build and run the production image locally:

docker build -f phicite/Dockerfile.prod -t web ./phicite
docker run --name phicite -e PORT=8765 -e DATABASE_URL=sqlite://sqlite.db -p 5003:8765 web:latest

Navigate to http://localhost:5003/ping/.

Bring down the container when done:

docker rm phicite -f

Deploy to Heroku

heroku login
heroku create # store app name in APP_NAME
heroku container:login
heroku addons:create heroku-postgresql:essential-0 --app ${APP_NAME}

Run database migrations on Heroku

heroku login
heroku run -a ${APP_NAME} aerich upgrade

Run tests on production server

cd phicite
poetry run python prod_testing.py

To reset the database

To delete and recreate the existing web_dev and web_test databases in your Docker PostgreSQL container, you can use the following commands:

# Connect to the database container
docker compose exec web-db psql -U postgres

# Inside the PostgreSQL prompt, run:
DROP DATABASE IF EXISTS web_dev;
DROP DATABASE IF EXISTS web_test;

# Then create them again
CREATE DATABASE web_dev;
CREATE DATABASE web_test;

# Exit PostgreSQL
\q

Delete the migrations folder in your local repository and recreate it

rm -rf phicite/migrations
docker compose down
docker compose up -d --build
docker compose exec web aerich init -t app.db.TORTOISE_ORM

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages