Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add docker file
- Loading branch information
Showing
12 changed files
with
223 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.idea/ | ||
.git/ | ||
target/ | ||
logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM maven:3.6.1-jdk-8 | ||
LABEL MAINTAINER kevin.luy@antfin.com,xiangfeng.xzc@antfin.com | ||
|
||
ENV deploy_path /home/admin/deploy | ||
|
||
|
||
COPY . $deploy_path/source | ||
|
||
|
||
RUN mkdir -p /root/.m2 && \ | ||
cd $deploy_path/source && \ | ||
mv docker/settings-aliyun.xml /root/.m2/settings.xml && \ | ||
mv docker/entrypoint.sh $deploy_path/entrypoint.sh && \ | ||
chmod a+x $deploy_path/entrypoint.sh && \ | ||
mvn clean package -Psofaark -B -e -T 1C -Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 -Dmaven.test.skip=true -am -pl boot/all-in-one-bootstrap && \ | ||
mv $deploy_path/source/boot/all-in-one-bootstrap/target/allinone-executable.jar $deploy_path/app.jar && \ | ||
cd ~ && \ | ||
rm -rf /root/.m2 $deploy_path/source && \ | ||
useradd admin && \ | ||
chown -R admin:admin /home/admin | ||
|
||
EXPOSE 6200 7200 9090 | ||
|
||
VOLUME /home/admin/logs /home/admin/lookout_gateway_queue_cache | ||
|
||
USER admin | ||
WORKDIR /home/admin | ||
|
||
ENTRYPOINT ["/home/admin/deploy/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
# all in one 打包方式 | ||
current_dir=$( dirname $0) | ||
cd $current_dir/../.. | ||
mvn clean install -T 1C -Psofaark -Dmaven.test.skip=true -am -pl boot/all-in-one-bootstrap | ||
|
||
|
||
# 单独打包方式, 需要排除all-in-one模块, 否则会报错 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 介绍 # | ||
使用docker的方式来部署all-in-one-bootstrap. | ||
|
||
# 构建镜像 # | ||
|
||
在项目根目录执行 | ||
```bash | ||
docker build -t lookout/allinone:1.0.0 . | ||
``` | ||
|
||
> 为了在国内获得较好的构建速度, 构建时使用了aliyun的maven仓库. | ||
## docker方式运行 ## | ||
先运行ES | ||
``` | ||
docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:5.6 | ||
``` | ||
|
||
服务端默认会连接到`localhost:9200`的ES实例, 而我所用的开发机器是MacOS, 无法使用`--net=host`模式启动容器, 因此在容器内无法通过`localhost:9200`连接ES, 需要使用如下方式绕过去: | ||
|
||
编辑一个配置文件, 比如foo.properties | ||
```properties | ||
gateway.metrics.exporter.es.host=es | ||
metrics-server.spring.data.jest.uri=http://es:9200 | ||
``` | ||
|
||
在foo.properties所在的目录下运行all-in-one镜像 | ||
```bash | ||
docker run -it \ | ||
--name allinone \ | ||
--link es:es \ | ||
-v $PWD/foo.properties:/home/admin/deploy/foo.properties \ | ||
-e JAVA_OPTS="-Dlookoutall.config-file=/home/admin/deploy/foo.properties" \ | ||
lookout/allinone:1.0.0 | ||
``` | ||
|
||
> 这里利用了docker的--link参数使得应用可以访问到ES实例 | ||
> 这里做测试用, 所以不用-d参数在后台运行 | ||
|
||
如果在linux上启动则quickstart例子无需上述设置, 直接执行如下语句即可: | ||
```bash | ||
docker run -it \ | ||
--name allinone \ | ||
lookout/allinone:1.0.0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# all in one entry point | ||
|
||
java_bin=java | ||
app_jar=/home/admin/deploy/app.jar | ||
|
||
# 构建 JVM 系统属性 | ||
java_opts="-Dcom.alipay.sofa.ark.master.biz=lookoutall" | ||
java_opts="$java_opts $JAVA_OPTS" | ||
|
||
echo $java_bin -server $java_opts $app_jar | ||
$java_bin -server $java_opts -jar $app_jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
<profiles> | ||
<profile> | ||
<id>aliyun</id> | ||
<repositories> | ||
<repository> | ||
<id>aliyun</id> | ||
<url>https://maven.aliyun.com/repository/central</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>aliyun</id> | ||
<url>https://maven.aliyun.com/repository/central</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
</profile> | ||
|
||
</profiles> | ||
|
||
<activeProfiles> | ||
<activeProfile>aliyun</activeProfile> | ||
</activeProfiles> | ||
|
||
</settings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.alipay.sofa.lookout</groupId> | ||
<artifactId>lookout-parent</artifactId> | ||
<version>1.6.0</version> | ||
<packaging>pom</packaging> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<licenses> | ||
<license> | ||
<name>The Apache License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
<developers> | ||
<developer> | ||
<name>kevin.luy</name> | ||
<email>kevin.luy@antfin.com</email> | ||
<organization>Ant Financial</organization> | ||
<organizationUrl>https://www.alipay.com/</organizationUrl> | ||
</developer> | ||
</developers> | ||
<modules> | ||
<module>client</module> | ||
<!--gateway modules--> | ||
<module>gateway</module> | ||
<module>gateway/core</module> | ||
<module>gateway/metrics/pipeline</module> | ||
<module>gateway/metrics/starter</module> | ||
<module>gateway/metrics/importer/standard</module> | ||
<module>gateway/metrics/importer/opentsdb</module> | ||
<module>gateway/metrics/importer/prometheus</module> | ||
<module>gateway/metrics/importer/metricbeat</module> | ||
<module>gateway/metrics/exporter/elasticsearch</module> | ||
<module>gateway/metrics/exporter/standard</module> | ||
<!--server modules--> | ||
<module>server</module> | ||
<module>server/common</module> | ||
<module>server/metrics/promql</module> | ||
<module>server/metrics/storage-ext-es</module> | ||
<module>server/metrics/interfaces</module> | ||
<module>server/metrics/starter</module> | ||
<module>server/metrics/web-ui</module> | ||
<module>server/server-test</module> | ||
<!-- boot modules--> | ||
<module>boot/gateway-bootstrap</module> | ||
<module>boot/metrics-server-bootstrap</module> | ||
<module>boot/sofa-ark-support</module> | ||
</modules> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.alipay.sofa.lookout</groupId> | ||
<artifactId>lookout-parent</artifactId> | ||
<version>1.6.0</version> | ||
<packaging>pom</packaging> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<licenses> | ||
<license> | ||
<name>The Apache License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
<developers> | ||
<developer> | ||
<name>kevin.luy</name> | ||
<email>kevin.luy@antfin.com</email> | ||
<organization>Ant Financial</organization> | ||
<organizationUrl>https://www.alipay.com/</organizationUrl> | ||
</developer> | ||
</developers> | ||
<modules> | ||
<module>client</module> | ||
<!--gateway modules--> | ||
<module>gateway</module> | ||
<module>gateway/core</module> | ||
<module>gateway/metrics/pipeline</module> | ||
<module>gateway/metrics/starter</module> | ||
<module>gateway/metrics/importer/standard</module> | ||
<module>gateway/metrics/importer/opentsdb</module> | ||
<module>gateway/metrics/importer/prometheus</module> | ||
<module>gateway/metrics/importer/metricbeat</module> | ||
<module>gateway/metrics/exporter/elasticsearch</module> | ||
<module>gateway/metrics/exporter/standard</module> | ||
<!--server modules--> | ||
<module>server</module> | ||
<module>server/common</module> | ||
<module>server/metrics/promql</module> | ||
<module>server/metrics/storage-ext-es</module> | ||
<module>server/metrics/interfaces</module> | ||
<module>server/metrics/starter</module> | ||
<module>server/metrics/web-ui</module> | ||
<module>server/server-test</module> | ||
<!-- boot modules--> | ||
<module>boot/gateway-bootstrap</module> | ||
<module>boot/metrics-server-bootstrap</module> | ||
<module>boot/sofa-ark-support</module> | ||
</modules> | ||
|
||
<profiles> | ||
<profile> | ||
<id>sofaark</id> | ||
<modules> | ||
<module>boot/all-in-one-bootstrap</module> | ||
</modules> | ||
</profile> | ||
</profiles> | ||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>pl.project13.maven</groupId> | ||
<artifactId>git-commit-id-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>revision</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<generateGitPropertiesFile>true</generateGitPropertiesFile> | ||
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo> | ||
<failOnNoGitDirectory>false</failOnNoGitDirectory> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>sofaark</id> | ||
<modules> | ||
<module>boot/all-in-one-bootstrap</module> | ||
</modules> | ||
</profile> | ||
</profiles> | ||
</project> |