forked from rubyangxg/jd-qinglong
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yangxg
committed
Sep 23, 2021
1 parent
b6de505
commit 04fb408
Showing
34 changed files
with
1,413 additions
and
896 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 |
---|---|---|
@@ -1,57 +1,30 @@ | ||
# 安装说明 | ||
|
||
## 前置要求 | ||
|
||
docker-compose更新至最新版: | ||
```bash | ||
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
docker-compose --version | ||
``` | ||
|
||
需要安装`docker-ce`及`docker-compose` | ||
点击以下连接了解如何安装`docker`及`compose` | ||
|
||
- [Debian](https://docs.docker.com/engine/install/debian/) | ||
- [Ubuntu](https://docs.docker.com/engine/install/ubuntu/) | ||
- [CentOS](https://docs.docker.com/engine/install/centos/) | ||
- [Fedora](https://docs.docker.com/engine/install/fedora/) | ||
- [Red Hat Enterprise Linux](https://docs.docker.com/engine/install/rhel/) | ||
- [SUSE Linux Enterprise Server](https://docs.docker.com/engine/install/sles/) | ||
|
||
## 安装 | ||
|
||
1. 新建一个文件夹,用于存放相关数据 | ||
2. 下载仓库中的`docker-compose-allinone.yml`至本地,或是复制文件内容后在本地自行建立并粘贴内容 | ||
3. 使用docker-compose启动 | ||
4. 打开浏览器使用 | ||
|
||
```bash | ||
# 新建数据文件夹 | ||
mkdir jd-qinglong | ||
cd jd-qinglong | ||
# 下载docker-compose.yml文件 | ||
wget -O docker-compose.yml https://raw.githubusercontent.com/rubyangxg/jd-qinglong/master/docker-compose-allinone.yml | ||
# 下载配置文件模板 | ||
wget -O env.properties https://raw.githubusercontent.com/rubyangxg/jd-qinglong/master/env.template.properties | ||
#确保env.properties和docker-compose.yml处于同级目录 | ||
#根据需要修改配置文件内容 | ||
# 启动 -d表示后台静默启动 | ||
sudo docker-compose up -d | ||
sudo docker-compose logs -f | ||
``` | ||
## 更新 | ||
|
||
请直接pull最新的docker镜像即可 | ||
|
||
```bash | ||
#停止阿东应用 | ||
docker-compose --env-file env.properties stop webapp | ||
docker rm webapp && sudo docker rmi -f rubyangxg/jd-qinglong:allinone | ||
#此操作不要轻易执行 | ||
#sudo docker-compose --env-file env.properties down | ||
#下载最新阿东镜像 | ||
docker pull rubyangxg/jd-qinglong:allinone | ||
docker-compose restart | ||
docker-compose up -d | ||
安装教程: | ||
1. 确保docker.sock存在(只要安装了docker一般都会有) | ||
``` | ||
ls -alh /var/run/docker.sock | ||
srw-rw---- 1 root root 0 Sep 21 19:46 /var/run/docker.sock | ||
``` | ||
2. 下载chrome镜像(仅需执行一次,后续更新不用重新下载) | ||
``` | ||
sudo docker pull selenoid/chrome:89.0 | ||
``` | ||
3. 下载rubyangxg/jd-qinglong镜像 | ||
``` | ||
sudo docker pull rubyangxg/jd-qinglong:1.1 | ||
``` | ||
4. 启动 | ||
``` | ||
sudo docker run -d -p 5701:8080 --name=webapp --privileged=true \ | ||
-e "SE_NODE_MAX_SESSIONS=8" | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v /[你的路径]/env.properties:/env.properties:ro \ | ||
rubyangxg/jd-qinglong:1.1 | ||
``` | ||
例如: | ||
``` | ||
sudo docker run -d -p 5701:8080 --name=webapp --privileged=true \ | ||
-e "SE_NODE_MAX_SESSIONS=8" \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v "$(pwd)"/env.properties:/env.properties:ro \ | ||
rubyangxg/jd-qinglong:1.1 | ||
``` |
This file was deleted.
Oops, something went wrong.
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,24 +1,26 @@ | ||
FROM selenium/standalone-chrome:4 | ||
ENV SE_NODE_SESSION_TIMEOUT=300 | ||
ENV SE_NODE_OVERRIDE_MAX_SESSIONS=true | ||
ENV SE_NODE_MAX_SESSIONS=4 | ||
ENV START_XVFB=false | ||
FROM adoptopenjdk/openjdk11:alpine | ||
|
||
ENV TIME_ZONE=Asia/Shanghai | ||
USER root | ||
|
||
VOLUME /tmp | ||
ARG JAR_FILE | ||
|
||
COPY ${JAR_FILE} app.jar | ||
COPY selenium.conf /etc/supervisor/conf.d/selenium.conf | ||
COPY start-webapp.sh /opt/bin/start-webapp.sh | ||
COPY sources.list /etc/apt/sources.list | ||
COPY notify /opt/bin/notify | ||
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone && \ | ||
COPY selenoid /usr/bin | ||
COPY start-webapp.sh /opt/bin/start-webapp.sh | ||
COPY config /etc/selenoid | ||
|
||
RUN apk add -U ca-certificates tzdata mailcap supervisor curl && rm -Rf /var/cache/apk/* && \ | ||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo "Asia/shanghai" >> /etc/timezone && \ | ||
chmod 755 /opt/bin/start-webapp.sh && \ | ||
chmod 755 /opt/bin/notify | ||
chmod 755 /opt/bin/notify && \ | ||
chmod 755 /usr/bin/selenoid | ||
|
||
USER seluser | ||
EXPOSE 8080 5900 | ||
EXPOSE 4444 8080 | ||
COPY supervisord.conf /etc/supervisord.conf | ||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] | ||
#JAVA_OPTS="-server -Xmx2g -Xms2g -Xss512k -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom " | ||
#DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=n " | ||
#ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom -jar -Dserver.port=8080 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,16 @@ | ||
{ | ||
"chrome": { | ||
"default": "89.0", | ||
"versions": { | ||
"89.0": { | ||
"image": "selenoid/chrome:89.0", | ||
"enableVNC": true, | ||
"port": "4444", | ||
"path": "/", | ||
"limit": 100, | ||
"privileged": true, | ||
"env" : ["LANG=en_US.UTF-8", "LANGUAGE=us:en", "LC_ALL=en_US.UTF-8", "limit=10"] | ||
} | ||
} | ||
} | ||
} |
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
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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,13 +1,12 @@ | ||
#!/usr/bin/env bash | ||
#!/bin/sh | ||
# wait-for-grid.sh | ||
set -e | ||
cmd="$@" | ||
while ! curl -sSL "http://localhost:4444/wd/hub/status" 2>&1 \ | ||
| jq -r '.value.ready' 2>&1 | grep "true" >/dev/null; do | ||
echo 'Waiting for the Grid' | ||
sleep 1 | ||
url="http://localhost:4444/status" | ||
code=`curl -I -m 30 -o /dev/null -s -w %{http_code}"\n" $url` #第一次访问,访问成功则不进入下面while循环 | ||
while [ $code -ne 200 ] | ||
do | ||
sleep 1s | ||
code=`curl -I -m 30 -o /dev/null -s -w %{http_code}"\n" $url` | ||
done | ||
>&2 echo "Selenium Grid is up - executing tests" | ||
exec $cmd | ||
|
||
#while循环访问url,直到状态码为200跳出循环 | ||
echo "开始启动webapp" | ||
java -Djava.security.egd=file:/dev/./urandom -jar -Dserver.port=8080 /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,26 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:webapp] # 你的程序名,随便命名 | ||
command=/opt/bin/start-webapp.sh | ||
autostart=true # 自动启动 | ||
autorestart=false | ||
startsecs=0 | ||
startretries=0 | ||
|
||
;Logs (all Hub activity redirected to stdout so it can be seen through "docker logs" | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
|
||
[program:selenoid] # 你的程序名,随便命名 | ||
command=/usr/bin/selenoid -listen :4444 -conf /etc/selenoid/browsers.json -limit 100 -container-network bridge | ||
autostart=true # 自动启动 | ||
autorestart=false | ||
startsecs=0 | ||
startretries=0 | ||
|
||
;Logs (all Hub activity redirected to stdout so it can be seen through "docker logs" | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 |
Oops, something went wrong.