更新部分镜像版本
This commit is contained in:
committed by
cloud-init created default user
parent
00f679a0f6
commit
f084d89eab
53
examples/xbrowsersync/compose.yaml
Normal file
53
examples/xbrowsersync/compose.yaml
Normal file
@@ -0,0 +1,53 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
xbrowsersync-db:
|
||||
#image: mongo:4.4.29
|
||||
image: mongo:7.0.11
|
||||
container_name: xbrowsersync-db
|
||||
restart: always
|
||||
networks:
|
||||
- app_network
|
||||
- site_network
|
||||
volumes:
|
||||
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro
|
||||
- ./db:/data/db
|
||||
- ./backup:/data/backups
|
||||
- ./conf/mongoconfig.js:/docker-entrypoint-initdb.d/mongoconfig.js
|
||||
environment:
|
||||
- "MONGO_INITDB_DATABASE=xbrowsersync"
|
||||
- "MONGO_INITDB_ROOT_USERNAME=xbrowsersync"
|
||||
- "MONGO_INITDB_ROOT_PASSWORD=12345678"
|
||||
- "XBS_DB_NAME=xbrowsersync"
|
||||
- "XBS_DB_USERNAME=xbrowsersync"
|
||||
- "XBS_DB_PASSWORD=123456"
|
||||
xbrowsersync:
|
||||
image: xbrowsersync/api:1.1.13-node20.14.0-alpine
|
||||
container_name: xbrowsersync
|
||||
restart: always
|
||||
networks:
|
||||
- app_network
|
||||
- site_network
|
||||
volumes:
|
||||
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro
|
||||
#- ./conf/settings.json:/opt/xbs/1.1.13/conf/settings.json
|
||||
#- ./logs:/var/log/xBrowserSync
|
||||
- ./conf/settings.json:/usr/src/api/config/settings.json
|
||||
- ./conf/healthcheck.js:/usr/src/api/healthcheck.js
|
||||
- ./logs:/var/log/xBrowserSync
|
||||
depends_on:
|
||||
- "xbrowsersync-db"
|
||||
healthcheck:
|
||||
test: [ "CMD", "node", "/usr/src/api/healthcheck.js" ]
|
||||
interval: "1m"
|
||||
timeout: "10s"
|
||||
retries: "5"
|
||||
start_period: "30s"
|
||||
|
||||
networks:
|
||||
app_network:
|
||||
external: true
|
||||
name: app_network
|
||||
site_network:
|
||||
external: true
|
||||
name: site_network
|
||||
44
examples/xbrowsersync/conf/healthcheck.js
Normal file
44
examples/xbrowsersync/conf/healthcheck.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const http = require('http');
|
||||
|
||||
const response = http.request(
|
||||
{
|
||||
host: '0.0.0.0',
|
||||
method: 'GET',
|
||||
path: '/info',
|
||||
port: 8080,
|
||||
timeout: 2000,
|
||||
},
|
||||
(res) => {
|
||||
let body = '';
|
||||
res.setEncoding('utf8');
|
||||
|
||||
res.on('data', (chunk) => {
|
||||
body += chunk;
|
||||
});
|
||||
|
||||
res.on('end', () => {
|
||||
if (res.statusCode === 200) {
|
||||
const payload = JSON.parse(body);
|
||||
switch (payload.status) {
|
||||
case 1:
|
||||
case 3:
|
||||
console.log('HEALTHCHECK: online');
|
||||
process.exit(0);
|
||||
case 2:
|
||||
default:
|
||||
console.log('HEALTHCHECK: offline');
|
||||
}
|
||||
} else {
|
||||
console.log('HEALTHCHECK: offline');
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
response.on('error', function (err) {
|
||||
console.log('HEALTHCHECK: offline');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
response.end();
|
||||
3
examples/xbrowsersync/conf/mongoconfig.js
Normal file
3
examples/xbrowsersync/conf/mongoconfig.js
Normal file
@@ -0,0 +1,3 @@
|
||||
db.newsynclogs.createIndex( { "expiresAt": 1 }, { expireAfterSeconds: 0 } );
|
||||
db.newsynclogs.createIndex( { "ipAddress": 1 } );
|
||||
db.bookmarks.createIndex( { "lastAccessed": 1 }, { expireAfterSeconds: 21*86400 } );
|
||||
16
examples/xbrowsersync/conf/settings.json
Normal file
16
examples/xbrowsersync/conf/settings.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"location": "JP",
|
||||
"maxSyncs": "10000",
|
||||
"maxSyncSize": "10485760",
|
||||
"db": {
|
||||
"host": "xbrowsersync-db",
|
||||
"name": "xbrowsersync",
|
||||
"username": "xbrowsersync",
|
||||
"password": "aP7xvybVU6ZdVKWkTp7NjbcYuFdH5YR6Gi3aFrvdT4kbJ3aKwFqB4GnxYyao5DgR"
|
||||
},
|
||||
"status": {
|
||||
"allowNewSyncs": "true",
|
||||
"online": "true",
|
||||
"message": "Welcome to the HTY1024 xBrowserSync service! We run the latest version of the xBrowserSync API and take database backups daily."
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user