diff --git a/README.md b/README.md index 8ca2e69fa..894722b2d 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..30eaaf83f --- /dev/null +++ b/docker-compose.yml @@ -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 diff --git a/docs/README.md b/docs/README.md index d9f230420..9c9466ad0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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 diff --git a/docs/operating/compose.md b/docs/operating/compose.md new file mode 100644 index 000000000..f2b3b9f6b --- /dev/null +++ b/docs/operating/compose.md @@ -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).