Docker compose file for simpler dev env (#526)

* Docker compose file for simpler dev env

* Updating readme, adding UI to compose

* Define dependencies between services

* Prometheus. Grafana

* Link Prometheus to Grafana service

* Addressing review comments

* Linking compose doc to common table of content
This commit is contained in:
Denis Makogon
2017-11-28 22:31:34 +02:00
committed by Derek Schultz
parent 84382d51d3
commit 81e3c4387c
4 changed files with 82 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ fn start
This will start Fn in single server mode, using an embedded database and message queue. You can find all the
configuration options [here](docs/operating/options.md). If you are on Windows, check [here](docs/operating/windows.md).
### Your First Function
Functions are small but powerful blocks of code that generally do one simple thing. Forget about monoliths when using functions, just focus on the task that you want the function to perform.

66
docker-compose.yml Normal file
View File

@@ -0,0 +1,66 @@
version: '3'
services:
db:
image: "mysql"
restart: always
ports:
- "3306:3306"
environment:
- "MYSQL_DATABASE=funcs"
- "MYSQL_ROOT_PASSWORD=root"
mq:
image: "redis"
restart: always
ports:
- "6379:6379"
fnserver:
depends_on:
- mq
- db
build: .
ports:
- "8080:8080"
links:
- "db"
- "mq"
environment:
- DB_URL=mysql://root:root@tcp(db:3306)/funcs
- MQ_URL=redis://mq:6379/
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
mode: replicated
replicas: 3
grafana:
image: grafana/grafana
restart: always
ports:
- "3000:3000"
links:
- fnserver
- prometheus
depends_on:
- fnserver
- prometheus
prometheus:
image: prom/prometheus
restart: always
depends_on:
- fnserver
ports:
- "9090:9090"
links:
- fnserver
volumes:
- ${GOPATH}/src/github.com/fnproject/fn/examples/grafana/prometheus.yml:/etc/prometheus/prometheus.yml
fnserver-ui:
depends_on:
- fnserver
image: fnproject/ui
restart: always
ports:
- "4000:4000"
links:
- "fnserver"
environment:
- API_URL=http://fnserver:8080

View File

@@ -22,6 +22,7 @@ If you are a developer using Fn through the API, this section is for you.
* [API Reference](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/fnproject/fn/master/docs/swagger.yml)
* [Object Model](developers/model.md)
* [FAQ](faq.md)
* [Setting up development environment with Docker compose](./operating/compose.md)
## For Operators

14
docs/operating/compose.md Normal file
View File

@@ -0,0 +1,14 @@
# Development environment deployment with Docker compose
### Deployment details
With [Docker Compose file](../../docker-compose.yml) it's easy to bootstrap the full Fn development stack that includes the following components:
- MySQL server for database
- Redis server for message queue
- Fn server with scale group (supported only for Docker Swarm)
- Fn UI
- Grafana
- Prometheus
Given compose file was developed specifically for Fn platform development/testing purpose, it's not a production-ready script. In order to get production deployment please review [Kubernetes deployment instruction](./kubernetes/README.md).