Penny (http://mypenny.co) is a free tool to help people split complicated group expenses with their friends. The service is launched in 2016 and getting more and more popular nowadays because it's so easy to use. Not like other group expense tool, Penny doesn't require sign up or login. You just need to share the URL to your friends, then everyone can start filling the expense they paid from their own device. In the meantime, the settlement will be calculated automatically to guide you how to pay out.
In order to make it not only free for users, but also for developers, I've open sourced this project in 2018. This backend service is running
on Google Compute Engine. DNS is managed by AWS Route 53, where the CNAME http://api.mypenny.co
is defined.
- Make sure Python 3.7.0 is installed
- Setup virtualenv
python3 -m venv env
- Activate virtual env
source ./env/bin/activate
- Download dependencies
pip install -r requirements.txt
- Start server
./scripts/debug.sh
- Deactivate after development
deactivate
This project use Circle CI to build and publish the docker image, and then update the Google Compute Engine with the new container image.
I built a custom image which contains both gcloud-sdk and python3.7 here
https://hub.docker.com/r/liyanjia92/gcloudpython/
Circle CI will pull this image, authenticate through gcloud with the JSON key of the service account, then download the instance config for the app. Next, docker will build a new image for the project, login with GCP JSON key, then push to gcr.io (Google Container Registry)
If you need to deploy manually:
- Make sure Docker is installed
- Make sure
gcloud
is also installed - Build the image
docker build -t penny-api:$(git log -1 --pretty=%h) .
- Run a container with this image for testing
docker run -p 80:8000 penny-api:$(git log -1 --pretty=%h)
- GET
http://localhost/common/lang
to ensure the container runs correctly - Push the image to gcr.io
docker push gci.io/mypennyco/penny-api:$(git log -1 --pretty=%h)
- Refactor the validation logic for event/expense
- Add unit tests