Using redirection.io with Docker

It is quite common to use Docker in development or production environments. As this has been requested by several of our users, we have set up different examples to show how to integrate redirection.io in various Docker setups.

This sample project can be found on our Github account: https://github.com/redirectionio/docker-example

We do not distribute docker images for the redirection.io agent, as we believe this would be counterproductive. The agent itself is a single static binary and, given the diversity on docker images construction methods, we think it is simpler to use these examples as inspiration for your own context.

Available Docker layouts

  • agent-as-reverse-proxy: the redirection.io agent, installed from our repository, is used as a reverse proxy. This is the most simple and recommended setup.
  • apache-module: a simple Apache setup, with redirection.io module installed from our apt repository
  • apache-module-custom: an Apache setup with the redirection.io module compiled from sources
  • nginx-module: a simple nginx setup, with redirection.io module installed from our apt repository
  • nginx-module-custom: a nginx setup with the redirection.io module compiled from sources

Usage

  • clone the repository
    git clone https://github.com/redirectionio/docker-example.git
    cd docker-example
    
  • create an account and a project on redirection.io and retrieve your project key in redirection.io's manager (click on the "Setup on your website" > "Setup on your infrastructure" button).
  • copy the .env.dist configuration file to .env and paste the project key in this file:
    REDIRECTIONIO_PROJECT_KEY=PASTE HERE YOUR REDIRECTION.IO PROJECT KEY
  • choose one of the docker example layouts proposed in the project and navigate to the according directory. For example:
    cd agent-as-reverse-proxy
    
  • build the infrastructure:
    docker-compose build
    
  • run it:
    docker-compose up -d
    

Kubernetes example

For Google Kubernetes Engine (GKE) users, we provide an example GKE project that may be helpful to get redirection.io work in your context: https://github.com/redirectionio/kubernetes-example/

Basically, it uses images built using the above docker example, for the redirectionio-agent and for nginx with the redirection.io module enabled.

Of course, you'll have to do some changes for your own context, but this might be helpful in case of troubles.

This page has been updated on July 2nd, 2024.
Can't find your answer?