Skip to content

Commit 9b97c28

Browse files
author
Bill Prin
committed
Basic Kinto Example
1 parent 2615c04 commit 9b97c28

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

managed_vms/kinto/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ RUN virtualenv /env
2727
# the context of the virtualenv and will have access to its dependencies.
2828
ENV VIRTUAL_ENV /env
2929
ENV PATH /env/bin:$PATH
30+
31+
# Kinto config file
3032
ENV KINTO_INI /etc/kinto/kinto.ini
3133

3234
# Install dependencies.
3335
ADD requirements.txt /app/requirements.txt
3436
RUN pip install -r /app/requirements.txt
37+
#Create Kinto config file and replace 8888 with 8080
3538
RUN kinto --ini $KINTO_INI --backend=memory init && sed -i 's/8888/8080/g' $KINTO_INI
3639

37-
# Add application code.
38-
ADD . /app
39-
40-
# Use Gunicorn to serve the application.
40+
# Run the Kinto kickoff command
4141
CMD kinto --ini $KINTO_INI migrate && kinto --ini $KINTO_INI start
4242

managed_vms/kinto/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Kinto Example
2+
3+
This is a basic example of running Mozillas [Kinto](https://github.com/Kinto/kinto/blob/master/docs/index.rst)
4+
on Managed VMs. Kinto provides a framework to sync JSON data across many devices and provide push notifications.
5+
Thius example uses a custom runtime to install Kinto and edit the config to run it on port 8080, which is the port that
6+
the base Docker image is expecting.
7+
8+
Since Kinto is being imported as a Python library and run as-is, no additional code is necessary.
9+
10+
Note that this is using Kinto's basic in-memory backend. As such, the instances are tied to 1. A production
11+
version of Kinto would use a PostgreSQL database and Redis cluster, which would allow scaling to many instances.
12+
13+
If you are interested in seeing this example expanded to use PostgreSQL, you can file an Issue on the Issue
14+
Tracker, or submit a Pull Request if you've accomplished it yourself.
15+
16+
17+
18+

managed_vms/kinto/app.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@
1717

1818
runtime: custom
1919
vm: true
20-
health_check:
21-
enable_health_check: False
20+
21+
# Kinto does not respond 404 to /_ah/health (sends a redirect)
2222
vm_health_check:
2323
enable_health_check: False
2424

25+
# Using an in-memory backend so lock instances to 1
2526
manual_scaling:
2627
instances: 1
2728

29+
2830
# Temporary setting to keep gcloud from uploading the virtualenv
2931
skip_files:
3032
- ^v?env$

managed_vms/kinto/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
gunicorn==19.4.5
22
oauth2client==1.5.2
3-
kinto
3+
kinto==1.11.2

0 commit comments

Comments
 (0)