Skip to main content
https://travis-ci.org/tsuru/varnishapi.png?branch=master

Deploying the API

First, let’s create an app in tsuru, from the project root, execute the following:

% tsuru app-create varnishapi python
% git remote add tsuru git@remote.sbrubles.com
% git push tsuru master

The push will return an error telling you that you can’t push code before the app unit is up, wait until your unit is in service, you can check with:

% tsuru app-list

When you get an output like this you can proceed to push.

+-------------+-------------------------+--------------------------------------+
| Application | Units State Summary     | Address                              |
+-------------+-------------------------+--------------------------------------+
| your-app    | 1 of 1 units in-service | your-app.sa-east-1.elb.amazonaws.com |
+-------------+-------------------------+--------------------------------------+

Now if you access our app endpoint at “/” (you can check with tsuru app-info cmd) you should get a 404, which is right, since the API does not respond through this url.

Alright, let’s configure the application, it’ll need to talk with EC2 API, and it does so by using environment variables. Here’s what you need:

% tsuru env-set EC2_ENDPOINT=https://ec2.amazonaws.com EC2_ACCESS_KEY=your-access-key EC2_SECRET_KEY=your-secret-key

In order to get Varnish running, you can provide an AMI or a list of packages to install via user data. The AMI is specified via the AMI_ID environment variable, while the packages are specified by the API_PACKAGES environment variable. Users may specify both variables.

% tsuru env-set AMI_ID=your-ami-id API_PACKAGES=varnish vim-nox

You can also use a custom user-data url via USER_DATA_URL intead of API_PACKAGES. In this case, the return content body should contain VARNISH_SECRET_KEY word which will be replaced by proper varnish secret on remote machine.

% tsuru env-set AMI_ID=your-ami-id USER_DATA_URL=http://server/custom-user-data

Users may also specify a subnet for running with VPC. You can specify the subnet ID via the SUBNET_ID environment variable.

% tsuru env-set SUBNET_ID=your-subnet-id

One more thing: this API will use MongoDB to store information about instances, the MongoDB endpoint and the database name is also controlled via environment variables:

We’re done with our API! Let’s create the service in Tsuru.

Creating the Service

First you’ll have to change the manifest.yaml file located at the project root of our application. Change the production endpoint to point to the application address, your yaml should look like this:

id: varnish
password: some123
endpoint:
  production: varnishapi-endpoint.com

Now let’s tell tsuru it needs to registrate a new service, from the project root run, using crane:

% crane create manifest.yaml

And we’re done!

Metadata

Release files for tsuru-feaas 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsuru-feaas 0.10.0
File Size Uploaded
tsuru-feaas-0.10.0.tar.gz 11.9 kB Details

Release files / tsuru-feaas-0.10.0.tar.gz

Download URL tsuru-feaas-0.10.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ec5d68e70188d580f406ab7158376a3bb38b3833a30ab725195dd1f26b158d2e
BLAKE2b-256 checksum
How to use checksums
309255b225a2032f49946406982419fd39eda4a77a6e35f04816bfa3d35f0ae0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.10.0 This release

1 release file

0.9.8

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8

1 release file

0.7.5

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6

1 release file

0.5.8

1 release file

0.5.7

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5

1 release file

0.4.8

1 release file

0.4.7

1 release file

0.4.6

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page