This little web app is for uploading and pinning images in IPFS.
It uses Blockfrost.io in the backend for all IPFS operations.
I originally wrote it to keep my Flask skills sharp and to integrate the
I will probably not move forward with actually hosting a Mr. Pinner Pinning Lab, but the code is ready for a first crack at it.
+ Flask app Setup for expansion + Default site pages controlled with Flask Blueprints [app/home folder etc] + Authentication built in with Flask-Login [app/auth folder] + IPFS Upload and Pinning [app/lab folder] + Database controlled by SQLAlchemy [SQLite by default] + Monitored with New Relic
From the README.md in the Repo, how to set up the web app and get it running locally with Docker
Clone the repo
Containers need a local
.env file [see the example below]
Currently the DB needs to be initialized via the
manage.py Python script in
Create a virtualenv, then source it, then pip install the requirements
cd app virtualenv -p python3 venv source venv/bin/activate pip install -r requirements.txt
Then run the
manage.py script to create the default tables
python manage.py --create_db
This will create
You are now ready to
cd .. back to the main folder and run the
Now Built with Docker!
Run Docker compose
docker-compose up --build -d
This will build four containers.
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9c54a05016d7 nginx:latest "/docker-entrypoint.…" 9 seconds ago Up 6 seconds 0.0.0.0:80->80/tcp mr_pinners_pinning_lab_nginx_1 97ac194ad7e0 mr_pinners_pinning_lab_celery "celery -A pinning_l…" 13 seconds ago Up 10 seconds 5000/tcp mr_pinners_pinning_lab_celery_1 5121745d8b1b mr_pinners_pinning_lab_flask_app "gunicorn --bind 0.0…" 13 seconds ago Up 9 seconds 0.0.0.0:5000->5000/tcp flask_app 53adb4eda3f3 redis:latest "docker-entrypoint.s…" 15 seconds ago Up 12 seconds 6379/tcp redis
Once built and running go to http://localhost to signup and login
EXAMPLE local .env file
export DOCKER_BUILD_NUM='latest' export FLASK_APP=app.py export FLASK_DEBUG=1 export FLASK_ENV=development # Misc ENV vars export TOKEN_SALT='token' # Blockfrost API export BLOCKFROST_IPFS=YOUR_API_KEY # New Relic # Change out env based on environment export NEW_RELIC_ENVIRONMENT='development' export NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY export NEW_RELIC_LABELS='Application:MrPinnersPinningLab;Geo:World;Team:DEAFMICE;Environment:development'
Docker tear down and destroy
Stop the containers
docker container stop $(docker container list -q)
Prune the left over chaff
docker system prune -a -f