Skip to main content

Frontend as-a-service API for Tsuru PaaS

Project description

Varnish service API for tsuru PaaS
==================================

.. image:: https://travis-ci.org/tsuru/varnishapi.png?branch=master
:target: https://travis-ci.org/tsuru/varnishapi
Deploying the API
-----------------

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

.. highlight: bash

::

% tsuru app-create varnishapi python
% git remote add tsuru git@remote.sbrubles.com # the returned remote ;)
% 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:


.. highlight: bash

::

% tsuru app-list

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

.. highlight: bash

::

+-------------+-------------------------+--------------------------------------+
| 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:

.. highlight: bash

::

% 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.

.. highlight: bash

::

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

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

.. highlight: bash

::

% 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:

.. highlight: yaml

::

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

Now let's tell tsuru it needs to registrate a new service, from the project
root run, using `crane
<http://godoc.org/github.com/globocom/tsuru/cmd/crane>`_:

.. highlight: bash

::

% crane create manifest.yaml

And we're done!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsuru-feaas-0.6.1.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file tsuru-feaas-0.6.1.tar.gz.

File metadata

  • Download URL: tsuru-feaas-0.6.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tsuru-feaas-0.6.1.tar.gz
Algorithm Hash digest
SHA256 e4486568b7e49a64791568f9979a5677e26c9e4403dc47c0f21e0cea5a6092cf
MD5 e2098bbdb8de93c675b2da13727d3c90
BLAKE2b-256 95fb4e2434efd644b9c759a73a3913ae9579a109bfa5f2ce97fb659e6488c03f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page