Browse Source

Offer a better docker example (#75)

tags/v5.8.0
陈键冬 GitHub 6 years ago
parent
commit
595f2fd82c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 49 deletions
  1. +6
    -17
      Dockerfile
  2. +12
    -3
      README.md
  3. +20
    -18
      docker-compose.yml
  4. +3
    -3
      docker/nginx/nginx.conf
  5. +0
    -8
      docker/scripts/sed.sh

+ 6
- 17
Dockerfile View File

@@ -1,22 +1,11 @@
FROM golang AS builder
# RUN apk add --no-cache git gcc
WORKDIR /app

COPY . .
RUN ./control build docker
FROM golang:1.13

FROM buildpack-deps:buster-curl
LABEL maintainer="llitfkitfk@gmail.com"
LABEL maintainer="llitfkitfk@gmail.com,chenjiandongx@qq.com"

WORKDIR /app

COPY --from=builder /app/docker/scripts /app/scripts
COPY --from=builder /app/etc /app/etc
# Change default address (hard code)
RUN ./scripts/sed.sh
RUN apt-get update && apt-get install net-tools -y

COPY --from=builder /app/bin /usr/local/bin


# ENTRYPOINT []
# CMD []
COPY . .
RUN ./control build docker
RUN mv /app/bin/* /usr/local/bin

+ 12
- 3
README.md View File

@@ -19,13 +19,22 @@ cd nightingale
./control build
```

## Quick Start (need install docker for [mac](https://docs.docker.com/docker-for-mac/install/)/[win](https://docs.docker.com/docker-for-windows/install/))
## Quickstart with Docker

We has offered a Docker demo for the users who want to give it a try. Before you get started, make sure you have installed **Docker** & **docker-compose** and there are some details you should know.

* We highly recommend users prepare a new VM environment to use it.
* All the core components will be installed on your OS according to the `docker-compose.yaml`.
* Nightingale will use the following ports, `80`, `5800`, `5810`, `5811`, `5820`, `5821`, `5830`, `5831`, `5840`, `5841`, `6379`, `2058`, `3306`.

Okay. Run it! Once the docker finish its jobs, visits http://your-env-ip in your broswer. Default username and password is `root:root`.
```bash
docker-compose up -d
# open http://localhost in web browser
$ docker-compose up -d
```

![dashboard](https://user-images.githubusercontent.com/19553554/78956965-8b9c6180-7b16-11ea-9747-6ed5e62b068d.png)


## Team

[ulricqin](https://github.com/ulricqin) [710leo](https://github.com/710leo) [jsers](https://github.com/jsers) [hujter](https://github.com/hujter) [n4mine](https://github.com/n4mine) [heli567](https://github.com/heli567)


+ 20
- 18
docker-compose.yml View File

@@ -1,28 +1,34 @@
version: "3"

volumes:
mysql-data:

services:
nginx:
image: nginx:stable-alpine
network_mode: host
ports:
- 80:80
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/conf.d:/etc/nginx/conf.d
- ./pub:/home/n9e/pub
api:

nightingale:
build: .
image: api
image: nightingale

monapi:
image: api
image: nightingale
network_mode: host
restart: always
command: n9e-monapi
ports:
- 5800:5800
transfer:
image: api
image: nightingale
network_mode: host
restart: always
command: n9e-transfer
ports:
@@ -30,7 +36,8 @@ services:
- 5811:5811

tsdb:
image: api
image: nightingale
network_mode: host
restart: always
command: n9e-tsdb
ports:
@@ -38,7 +45,8 @@ services:
- 5821:5821
index:
image: api
image: nightingale
network_mode: host
restart: always
command: n9e-index
ports:
@@ -46,7 +54,8 @@ services:
- 5831:5831

judge:
image: api
image: nightingale
network_mode: host
restart: always
command: n9e-judge
ports:
@@ -54,28 +63,23 @@ services:
- 5841:5841

collector:
image: api
image: nightingale
network_mode: host
restart: always
command: n9e-collector
ports:
- 2058:2058

# web:
# build:
# context: web
# restart: always
# command: npm run dev
# ports:
# - 8010:8010

redis:
image: redis
network_mode: host
restart: always
ports:
- 6379:6379

mysql:
image: mysql:5.7
network_mode: host
restart: always
environment:
- MYSQL_ROOT_PASSWORD=1234
@@ -84,5 +88,3 @@ services:
volumes:
- ./sql:/docker-entrypoint-initdb.d
- mysql-data:/var/lib/mysql

+ 3
- 3
docker/nginx/nginx.conf View File

@@ -47,17 +47,17 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

upstream n9e.monapi {
server monapi:5800;
server localhost:5800;
keepalive 10;
}

upstream n9e.index {
server index:5830;
server localhost:5830;
keepalive 10;
}

upstream n9e.transfer {
server transfer:5810;
server localhost:5810;
keepalive 10;
}



+ 0
- 8
docker/scripts/sed.sh View File

@@ -1,8 +0,0 @@
#!/bin/bash

set -xe

sed -i 's/127.0.0.1:6379/redis:6379/g' /app/etc/judge.yml
sed -i 's/127.0.0.1:6379/redis:6379/g' /app/etc/monapi.yml
sed -i 's/127.0.0.1:3306/mysql:3306/g' /app/etc/mysql.yml
sed -i 's/127.0.0.1:5821/tsdb:5821/g' /app/etc/transfer.yml

Loading…
Cancel
Save