Open xthursdayx opened 3 years ago
Also, just to provide further info this is what is in my settings.json:
{
"dailyNewSyncsLimit": 0,
"db": {
"host": "db"
}
"maxSyncs": 5242,
"maxSyncSize": 1048576,
"status": {
"allowNewSyncs": true,
"message": "Welcome to my XBrowserSync instance",
"online": true
},
"throttle": {
"maxRequests": 1000,
"timeWindow": 300000
}
}
I am also having the same issue
I am having the same issue. While I was trying to find the syntax for settings.json, I noticed that https://github.com/xbrowsersync/api-docker doesn’t contain any settings.default,json file (as referenced in the (documentation)[https://github.com/xbrowsersync/api#3-modify-configuration-settings] (pt 4.). I tried setting server.behindProxy to true, but it didn’t help.
I am also having issues with it constantly crashing, but in my kubernetes cluster, but not my swarm cluster... The following settings.json
is my swarm config that works on v1.1.13
{
"db": {
"host": "db_mongodb",
"name": "xbrowsersync",
"username": "sxbs",
"password": "123password",
"authSource": "xbrowsersync"
},
"maxSyncs": 0,
"maxSyncSize": 1024000000,
"status": {
"allowNewSyncs": false,
"message": "Derpaholic xBrowserSync."
},
"server": {
"behindProxy": true,
"host": "xbs.derpaholic.com",
"https": {
"certPath": "",
"enabled": false,
"keyPath": ""
},
"port": 8080,
"relativePath": "/"
},
"dailyNewSyncsLimit": 0
}
Also here is my yaml files for kub if people wanted to check those
I am having the same issue. While I was trying to find the syntax for settings.json, I noticed that https://github.com/xbrowsersync/api-docker doesn’t contain any settings.default,json file (as referenced in the (documentation)[https://github.com/[xbrowsersync/api#3](https://github.com/xbrowsersync/api/pull/3)-modify-configuration-settings] (pt 4.). I tried setting server.behindProxy to true, but it didn’t help.
settings.default.json
are the DEFAULT settings, you provide a settings.json
to override them, like so:
https://github.com/xbrowsersync/api-docker/blob/master/settings.json
@xthursdayx are you able to run the API on it's own (not with docker)?
I have tried to run in a debug mode but no option exists to get any out before the container restarts.
Can you run the following command and paste the output here:
docker-compose logs --tail 50 --follow --timestamps api
Edit: also, to prevent the container from constantly restarting, update line 33 of docker-compose.yml
to restart: "no"
Hello. I encountered a similar problem, but under different conditions. I wanted to raise the service using Docker on my local network. The first step I set up everything on my work computer. I removed the reverse-proxy as I don't need it. And successfully started the xbrowsersync service on my computer. I installed the addon in my browser and set up the sync, everything works great. The second step I decided to move the xbrowsersync service to my server on the local network. I just copied the configuration files and ran them with $ sudo docker-compose up After that I got an error:
xbs-db | {"t":{"$date":"2022-08-16T10:33:03.520+00:00"},"s":"I", "c":"FTDC", "id":20625, "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/data/db/diagnostic.data"}}
xbs-db | {"t":{"$date":"2022-08-16T10:33:03.523+00:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}
xbs-db | {"t":{"$date":"2022-08-16T10:33:03.523+00:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"0.0.0.0"}}
xbs-db | {"t":{"$date":"2022-08-16T10:33:03.523+00:00"},"s":"I", "c":"NETWORK", "id":23016, "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
xbs-api | {"name":"xBrowserSync_api","hostname":"d8895449fdc4","pid":1,"level":50,"req":null,"err":{"message":"Server selection timed out after 30000 ms","name":"MongooseServerSelectionError","stack":"MongooseServerSelectionError: Server selection timed out after 30000 ms\n at NativeConnection.Connection.openUri (/usr/src/api/node_modules/mongoose/lib/connection.js:845:32)\n at /usr/src/api/node_modules/mongoose/lib/index.js:348:10\n at /usr/src/api/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5\n at new Promise (<anonymous>)\n at promiseOrCallback (/usr/src/api/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10)\n at Mongoose._promiseOrCallback (/usr/src/api/node_modules/mongoose/lib/index.js:1152:10)\n at Mongoose.connect (/usr/src/api/node_modules/mongoose/lib/index.js:347:20)\n at Object.connect (/usr/src/api/dist/db.js:55:34)\n at Object.createApplication (/usr/src/api/dist/server.js:64:18)\n at /usr/src/api/dist/api.js:6:32\n at Object.<anonymous> (/
usr/src/api/dist/api.js:8:3)\n at Module._compile (internal/modules/cjs/loader.js:1063:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)\n at Module.load (internal/modules/cjs/loader.js:928:32)\n at Function.Module._load (internal/modules/cjs/loader.js:769:14)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)"},"msg":"Unable to connect to database","time":"2022-08-16T10:33:28.849Z","v":0}
^CGracefully stopping... (press Ctrl+C again to force)
Stopping xbs-api ... done
Stopping xbs-db ... done
My settings. .env:
#API_HOSTNAME=xbsapi.yourdomain.org
DB_NAME=xbrowsersync
DB_PASSWORD=my_pass
DB_USERNAME=user
COMPOSE_CONVERT_WINDOWS_PATHS=1
settings.json:
{
"db": {
"host": "db"
},
"status": {
"message": "xBrowserSync!"
},
"dailyNewSyncsLimit": 30,
"maxSyncSize": 104857600,
}
docker-compose.yml:
version: "3.7"
services:
db:
container_name: "xbs-db"
environment:
- "MONGO_INITDB_DATABASE=$DB_NAME"
- "MONGO_INITDB_ROOT_PASSWORD=$DB_PASSWORD"
- "MONGO_INITDB_ROOT_USERNAME=$DB_USERNAME"
- "XBS_DB_NAME=$DB_NAME"
- "XBS_DB_PASSWORD=$DB_PASSWORD"
- "XBS_DB_USERNAME=$DB_USERNAME"
image: "mongo:4.4.4"
restart: "unless-stopped"
volumes:
- "./xbs-db-data:/data/db"
- "./xbs-db-backups:/data/backups"
- "./mongoconfig.js:/docker-entrypoint-initdb.d/mongoconfig.js"
api:
container_name: "xbs-api"
depends_on:
- "db"
environment:
- "XBROWSERSYNC_DB_PWD=$DB_PASSWORD"
- "XBROWSERSYNC_DB_USER=$DB_USERNAME"
healthcheck:
test: [ "CMD", "node", "/usr/src/api/healthcheck.js" ]
interval: "1m"
timeout: "10s"
retries: "5"
start_period: "30s"
image: "xbrowsersync/api:1.1.13"
ports:
- "8080:8080"
restart: "unless-stopped"
volumes:
- "./settings.json:/usr/src/api/config/settings.json"
- "./healthcheck.js:/usr/src/api/healthcheck.js"
#reverse-proxy:
#command: "caddy reverse-proxy --from $API_HOSTNAME --to api:8080"
#container_name: "xbs-reverse-proxy"
#depends_on:
#- "api"
#image: "caddy:2.3.0-alpine"
#ports:
#- "443:443"
#- "80:80"
#restart: "unless-stopped"
#volumes:
#- "xbs-caddy-config:/config"
#- "xbs-caddy-data:/data"
#volumes:
#xbs-caddy-config:
#xbs-caddy-data:
#xbs-db-backups:
#xbs-db-data:
I didn't change the files, healthcheck.js and mongoconfig.js.
Hello. I encountered a similar problem, but under different conditions. I wanted to raise the service using Docker on my local network. The first step I set up everything on my work computer. I removed the reverse-proxy as I don't need it. And successfully started the xbrowsersync service on my computer. I installed the addon in my browser and set up the sync, everything works great. The second step I decided to move the xbrowsersync service to my server on the local network. I just copied the configuration files and ran them with $ sudo docker-compose up After that I got an error:
I figured out what the problem is, maybe it will help someone else too. Installed but not used nftables blocks access to the Docker network!
settings.json:
{ "db": { "host": "db" }, "status": { "message": "xBrowserSync!" }, "dailyNewSyncsLimit": 30, "maxSyncSize": 104857600, }
I didn't change the files, healthcheck.js and mongoconfig.js.
You have a trailing comma in your json which would be a syntax error (for JSON), but my files are otherwise the same as yours and xbs-api just won't start. I did the same as is recommended in #13
I didn't want to highjack this issue: https://github.com/xbrowsersync/api-docker/issues/13 but I too am trying to run the xbrowsersync api-docker stack without caddy, so that I can then use NGINX to reverse proxy the container, since I already use it for other containers, but am running into some issues.
I've tried creating and starting the stack with the
docker-compose.yml
(only modified to change the mounted port) you posted in issue https://github.com/xbrowsersync/api-docker/issues/13 usingdocker-compose up -d
and have also tried creating the stack via Portainer using the docker-compose as a template. I've also tried just creating the api-docker container manually with adocker run
command including all of the necessary variables and a separately created MongoDB.For some reason in each case the MongoDB container and xbs-api container are created and the db container seems to function normally, but the xbs-api container continually restarts and won't stay connected to the xbs docker network that is created. I've tried changing the healthcheck interval, timeout length, retries, and start period, and also tried removing the healthcheck entirely, just to see, but it found the same issue, though I couldn't tell if the container was restarting or just refusing to connect to the xbrowsersync docker network and mount the 8080 port.
I am unable to access the internal container logs because the container is continually restarting and there isn't anything in the external logs for the xbs-api container. The most information I could find was by inspecting the container in Portainer, which listed this information about the container:
I am trying to start the container on unRAID which is an OS based on Slackware. Any advice or suggestion would bee much appreciated. Thanks!