blob: 82039b80d1c28480af57c5bd3212c69648a484d3 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# To use this compose you should first build Traffic Ops and then copy the RPM to :
#
# trafficcontrol/infrastructure/cdn-in-a-box/traffic_ops/traffic_ops.rpm
#
# cd trafficcontrol/infrastructure/cdn-in-a-box
#
# Adjust the settings in `variables.env` to suit your needs.
#
# docker-compose up -d
#
# The Traffic Ops Go API will then be available on https://localhost:6443,
# the Perl API on https://localhost:60443, and the postgres database on localhost 5432.
#
# Note that this setup is intended for testing and not for production use.
---
version: '2.1'
services:
# db is the Traffic Ops database running in postgresql. Only trafficops and trafficops-perl need to have access to it.
# All other components access the database thru the Traffic Ops API
db:
build:
context: .
dockerfile: traffic_ops/Dockerfile-db
hostname: db
domainname: infra.ciab.test
depends_on:
- dns
volumes:
- /var/lib/postgresql/data
- shared:/shared
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
env_file:
- variables.env
# TODO: change to expose: "5432" to limit to containers
# trafficops runs only the Go version of Traffic Ops in a container. All Traffic Ops API endpoints that have
# been rewritten in Go will be handled here. All that have not are passed to the trafficops-perl service
# defined below
trafficops:
build:
context: .
dockerfile: traffic_ops/Dockerfile-go
depends_on:
- db
- enroller
- trafficops-perl
domainname: infra.ciab.test
env_file:
- variables.env
hostname: trafficops
image: trafficops-go
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
# trafficops-perl runs the legacy Traffic Ops in Perl using the Mojolicious framework. This remains
# in place until all API endpoints have been rewritten in Go
trafficops-perl:
build:
context: ../..
dockerfile: infrastructure/cdn-in-a-box/traffic_ops/Dockerfile
args:
TRAFFIC_OPS_RPM: infrastructure/cdn-in-a-box/traffic_ops/traffic_ops.rpm
depends_on:
- db
- enroller
domainname: infra.ciab.test
env_file:
- variables.env
hostname: trafficops-perl
image: trafficops-perl
# TODO: change to expose: "60443" to limit to containers
volumes:
- ./traffic_ops/ca:/ca
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- ./traffic_ops/set-to-ips-from-dns.sh:/usr/local/sbin/set-to-ips-from-dns.sh
- shared:/shared
# trafficportal defines the web interface for Traffic Ops. It uses only the API exposed by Traffic Ops
# and passes any /api/... routes directly to Traffic Ops
trafficportal:
build:
context: .
dockerfile: traffic_portal/Dockerfile
args:
TRAFFIC_PORTAL_RPM: traffic_portal/traffic_portal.rpm
depends_on:
- enroller
domainname: infra.ciab.test
env_file:
- variables.env
hostname: trafficportal
image: trafficportal
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
# trafficmonitor is an HTTP service that monitors the caches in a CDN for a variety of metrics
trafficmonitor:
build:
context: .
dockerfile: traffic_monitor/Dockerfile
args:
TRAFFIC_MONITOR_RPM: traffic_monitor/traffic_monitor.rpm
depends_on:
- enroller
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
domainname: infra.ciab.test
env_file:
- variables.env
hostname: trafficmonitor
image: trafficmonitor
# trafficrouter routes clients to the most optimal cache
trafficrouter:
build:
context: .
dockerfile: traffic_router/Dockerfile
args:
TRAFFIC_ROUTER_RPM: traffic_router/traffic_router.rpm
TOMCAT_RPM: traffic_router/tomcat.rpm
depends_on:
- enroller
domainname: infra.ciab.test
env_file:
- variables.env
hostname: trafficrouter
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
# trafficstats collect traffic information
trafficstats:
build:
context: .
dockerfile: traffic_stats/Dockerfile
depends_on:
- enroller
- influxdb
domainname: infra.ciab.test
env_file:
- variables.env
hostname: trafficstats
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
influxdb:
build:
context: .
dockerfile: traffic_stats/Dockerfile-influxdb
hostname: influxdb
domainname: infra.ciab.test
depends_on:
- dns
env_file:
- variables.env
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
# trafficvault runs a riak container to store private keys
trafficvault:
build:
context: .
dockerfile: traffic_vault/Dockerfile
depends_on:
- enroller
environment:
- CLUSTER_NAME=trafficvault
labels:
- "com.basho.riak.cluster.name=trafficvault"
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- schemas:/etc/riak/schemas
- shared:/shared
domainname: infra.ciab.test
env_file:
- variables.env
hostname: trafficvault
# edge cache
edge:
privileged: True
build:
context: ../..
dockerfile: infrastructure/cdn-in-a-box/cache/Dockerfile
domainname: infra.ciab.test
env_file:
- variables.env
hostname: edge
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- ./edge/run.sh:/opt/init.d/99-run.sh
- shared:/shared
# mid cache
mid:
privileged: True
build:
context: ../..
dockerfile: infrastructure/cdn-in-a-box/cache/Dockerfile
domainname: infra.ciab.test
env_file:
- variables.env
hostname: mid
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- ./mid/run.sh:/opt/init.d/99-run.sh
- shared:/shared
# origin provides the content to be distributed through the CDN caches
origin:
build:
context: .
dockerfile: origin/Dockerfile
depends_on:
- enroller
domainname: infra.ciab.test
env_file:
- variables.env
hostname: origin
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
- ./origin/content:/var/www/html
# enroller provides a way to register component instances with traffic_ops
enroller:
build:
context: ../..
dockerfile: infrastructure/cdn-in-a-box/enroller/Dockerfile
depends_on:
- dns
env_file:
- variables.env
hostname: enroller
volumes:
- ./dns/set-dns.sh:/usr/local/sbin/set-dns.sh
- ./dns/insert-self-into-dns.sh:/usr/local/sbin/insert-self-into-dns.sh
- shared:/shared
# Bind9 DNS services work in combination with the traffic router to route clients to the optimal cache
dns:
build:
context: .
dockerfile: dns/Dockerfile
env_file:
- variables.env
volumes:
- ./dns/set-self-dns.sh:/usr/local/sbin/set-self-dns.sh
- ./dns/set-dns-update.sh:/usr/local/sbin/set-dns-update.sh
- shared:/shared
hostname: dns
domainname: infra.ciab.test
volumes:
schemas:
external: false
shared:
external: false
content:
external: false
ca:
external: false