ducky/subscriptions

Paddy 2015-06-30 Parent:61c4ce5850da

5:fe8f092cc149 Go to Latest

ducky/subscriptions/sql/postgres_init.sql

Make subscriptions Kubernetes-ready. Update our .hgignore file to include the docker-ready subscripionsd binary (which differs from the local subscriptionsd binary only in that it's statically-compiled for linux). Add a replication controller for subscriptionsd that will spin up the appropriate pods for us and make sure our Stripe and Subscriptionsd secret volumes are attached, so the pods may configure themselves with that private info. Create a Stripe secret volume with a placeholder for the stripe secret key. Create a Subscriptionsd secret volume with the DSN sent to the base64 encoding of an empty string right now (which means subscriptionsd will store data in memory, but whatever.) Create a subscriptionsd service that will route traffic to the subscriptionsd pods created by the replication controller. Create a minimal Dockerfile to get the subscriptionsd binary running on kubernetes. Add a build-docker helper script that will compile a Docker-ready subscriptionsd binary (by compiling it in a Docker container). Copy a Ubuntu ca-certificates.crt file that we'll inject into our Dockerfile so the Stripe SSL can be resolved. Busybox doesn't have any certificates, by default. Create a wrapper script that will be run in the Docker container to read the secrets from our secret volumes and inject them as environment variables, which is what subscriptionsd understands.

History
1 CREATE TABLE IF NOT EXISTS subscriptions (
2 user_id VARCHAR(36) PRIMARY KEY,
3 stripe_subscription VARCHAR(36) UNIQUE NOT NULL,
4 plan VARCHAR(36) NOT NULL,
5 status VARCHAR(16) NOT NULL,
6 canceling BOOLEAN NOT NULL,
7 created TIMESTAMPTZ NOT NULL,
8 trial_start TIMESTAMPTZ NOT NULL,
9 trial_end TIMESTAMPTZ NOT NULL,
10 period_start TIMESTAMPTZ NOT NULL,
11 period_end TIMESTAMPTZ NOT NULL,
12 canceled_at TIMESTAMPTZ NOT NULL,
13 failed_charge_attempts INTEGER NOT NULL,
14 last_failed_charge TIMESTAMPTZ NOT NULL,
15 last_notified TIMESTAMPTZ NOT NULL
16 );