Run locally
- cd flask-app
- pip install -r requirements.txt
- python app.py
Run in docker
- Install docker
- docker build . -t imgurl-demo
- docker run -it -p 8080:5000 imgurl-demo
- Go to http://0.0.0.0:8080/
Run in kubernetes
- Set up gcloud account (see google documentation)
- Set up kubernetes cluster (see google documentation)
- Create a storage bucket named pexip-demo-files
- Create credentials that can access the bucket and copy it to the file storage-credentials.txt
- Change the settings in app.py to use external storage app.config['USE_EXTERNAL_STORAGE'] = True
- Init gcloud and kubectl to use your created cluster
- Install skaffold (https://skaffold.dev/docs/install/)
- skaffold run --tail
- 'kubectl get services' to find the IP to connect to
Credentials To store the files in
Test: curl -i -X POST host:port/post-file -H "Content-Type: image/jpeg" --data-binary "@path/to/file"
eg. curl -i -X POST 0.0.0.0:5000/api/v1/images -H "Content-Type: image/png" --data-binary "phone-lookup.png"
check the file by going to: 0.0.0.0:5000/api/v1/images/ Change size by going adding one of the size requirements like so 0.0.0.0:5000/api/v1/images/small/