Start a local containerized instance
With this guide we will help to setup the Xillio Link Redirector with docker. As part of this installation we will also create a Postgres database to be used.
Before you begin
Before proceeding, make sure you have at least the latest version of docker
and docker-compose
installed.
At the time of writing this documentation the recommended version should be equal to, or higher that the following.
$ docker --version
Docker version 20.10.13, build a224086
$ docker-compose --version
Docker Compose version v2.3.3
Step 1. Setup your project directory
To keep things organized, create a new folder to store all our files.
For this guide we will assume this folder is called xlr
.
Step 2. Setup your docker-compose file
docker-compose.yml
version: '3.7'
services:
db:
image: postgres:14.2
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: example
POSTGRES_DB: xlr
volumes:
- ./.docker/db/data:/var/lib/postgresql/data
ports:
- 5432:5432
metrics:
image: influxdb:2.1-alpine
restart: always
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=influx
- DOCKER_INFLUXDB_INIT_PASSWORD=development
- DOCKER_INFLUXDB_INIT_ORG=xillio
- DOCKER_INFLUXDB_INIT_BUCKET=xlr
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=development
volumes:
- ./.docker/metrics/data:/var/lib/influxdb2
ports:
- 8086:8086
xlr:
image: xillio/link-redirector:latest
restart: always
ports:
- 80:80
- 443:443
- 8080:8080
- 8443:8443
volumes:
- ./certs:/app/certs
- ./config.yml:/app/config.yml
Step 3. Create your configuration file
config.yml
# Information on how the Xillio Link Redirector should act and be exposed towards the outside world
license:
key: YOUR-KEY-HERE
logger:
type: simple # The type of logger to use. choose from `simple`, `json`, or `void` (default: simple)
showStackTrace: false # Print the stack trace to stdout (default: false)
levels: # List of log-levels that should be shown. (default: all levels)
- audit # Possible values are ['trace', 'audit', 'http', 'debug', 'info', 'warn', 'error']
- http
- info
- warn
- error
proxy:
port: 80 # The port to use for HTTP connections (default: 80)
requestLogging: true # Enable logging incoming request to the console (default: false)
requestMonitoring: true # Enable measuring request data to a metric service (default: false)
# (Optional) Options for SSL connections.
# If `httpsPort` is defined, the `keyFile` and `certificateFile` also need to be specified.
httpsPort: 443 # The port to use for HTTPS connections (default: 443)
keyFile: ./certs/localhost.key # The path towards your certificate key file
certificateFile: ./certs/localhost.cert # The path towards your certificate file
# caFile: ./certs/rootCA.cert # (Optional) Override the root CA to use
forceHttps: true # Redirect all incoming HTTP request towards the HTTPS ports (default: false)
# (Optional) Additional configuration
# timeout: 10000 # Timeout for proxied request in milli seconds (default: 10000)
# addForwardedForHeaders: false # Add all headers of the incoming request to the proxied request (default: false)
# acceptUntrustedProxyTLS: false # Allow self-signed certificates for proxied requests (default: false)
# logProxyRequests: false # Log the proxied requests (default: false)
# maxUrlLength: 256 # The maximum length of the URL (default: 256)
api:
port: 8080 # The port to use for HTTP connections (default: 8080)
requestLogging: true # Enable logging of incoming request to stdout (default: false)
requestMonitoring: true # Enable measuring of request data to a metric service (default: false)
# (Optional) Options for SSL connections.
# If `httpsPort` is defined, the `keyFile` and `certificateFile` also need to be specified.
httpsPort: 8443 # The port to use for HTTPS connections (default: 8443)
keyFile: ./certs/localhost.key # The path to your certificate key file
certificateFile: ./certs/localhost.cert # The path to your certificate file
# caFile: ./certs/rootCA.cert # (Optional) Override the root CA to use
forceHttps: true # Redirect all incoming HTTP request towards the HTTPS ports (default: false)
# basePath: /xlr/api # The base path for all api endpoints (default: /xlr/api)
# maxUrlLength: 256 # The maximum length of the URL (default: 256)
# Configuration on the database connection
database:
type: postgres
url: postgresql://postgres:example@db:5432/xlr
# (Optional) Configuration for the metrics service to use for request and performance metrics
metrics:
type: influx
url: http://:development@metrics:8086
organization: xillio
performanceMonitoring: true # Enable measuring system performance to a metric service (default: false)
Step 4. Copy your certificates
Step 5. Tweak your config.yml
and docker-compose.yml
as needed
Step 6. Setup your database
Please refer to the database setup guide for more information.
Step 7. Start services
Whats next?
After these steps you should have your instance of the Xillio Link Redirector up and running. Next up are the following guides: