Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Docker compose #24

Open
MrModest opened this issue Jan 12, 2025 · 1 comment
Open

[Feature request] Docker compose #24

MrModest opened this issue Jan 12, 2025 · 1 comment

Comments

@MrModest
Copy link

Can you please provide a working example of a docker-compose file?

I tried to clone repo and run docker, but it gives me an error:

> insta-saver-bot@0.1.6 start
> node src/index.js

[2025-01-12 05:34:08.162] Insta saver running at http://localhost:6060

error: [polling_error] {"code":"EFATAL","message":"EFATAL: Telegram Bot Token not provided!"}
[2025-01-12 05:34:08.171] Error connecting to MongoDB: Error: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
    at NativeConnection.createClient (/app/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:219:11)
    at NativeConnection.openUri (/app/node_modules/mongoose/lib/connection.js:823:34)
    at Mongoose.connect (/app/node_modules/mongoose/lib/mongoose.js:429:15)
    at connectDB (/app/src/config/database.js:8:24)
    at Server.<anonymous> (/app/src/index.js:81:19)
    at Object.onceWrapper (node:events:641:28)
    at Server.emit (node:events:527:28)
    at emitListeningNT (node:net:1414:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

I run the container with the following parameters:

docker run \
  --net nginxnetwork \
  --name insta_saver_bot \
  -h insta_saver_bot \
  --restart unless-stopped  \
  insta_saver_bot:873966444730983be9af31c150dde1437e6693de
@leros1337
Copy link

Developer app is not working, because he not updated readme, env file and uses hardcoded localhost:6379 endpoint to redis here

I dont want to change code and rebuild image, so fast solution use network_mode: host. Also mongodb must be configured in replicaset mode or it crushes for me. But it requires keyfiles, tried disable it but still no connection. Tired to fix this bugs, so may require help

Close via ufw ports, or you will get hacked!

version: '3.9'

services:
  mongodb:
    image: mongo:latest
    container_name: mongodb
    environment:
      MONGO_INITDB_AUTH: "disabled"
      # MONGO_INITDB_ROOT_USERNAME: root
      # MONGO_INITDB_ROOT_PASSWORD: toor
      MONGO_INITDB_REPLICA_SET_NAME: rs0  # Set the replica set name
    command: ["mongod", "--replSet", "rs0"]  # Start MongoDB as a replica set
    volumes:
      - ./mongodb_data:/data/db
    network_mode: host

  insta-saver-bot:
    image: ghcr.io/akashvaghela09/insta-saver-bot:latest
    container_name: insta-saver-bot
    environment:
      - "MONGO_URI=mongodb://localhost:27017"
      - "TELEGRAM_TOKEN=token"
      - "PORT=6060"
    depends_on:
      - mongodb
      - redis
    network_mode: host

  redis:
    image: redis:latest
    container_name: redis
    network_mode: host

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants