Skip to content

pymongo.errors.InvalidURI Issue #27

@andisugandi

Description

@andisugandi

Hello @GGeorggg and Team,

Thank you for providing the updated forked project for the Airnotifier.

I build the image based on this Dockerfile, and trying to deploy it on Docker Swam cluster.

Here is the docker-compose.yml used:

version: '3.9'

services:
  mongodb:
    image: bitnami/mongodb:4.2.21
    volumes:
      - /PATH_TO/airnotifier.example.com/mongodb:/bitnami/mongodb
    networks:
      - airnotifiernetwork
    deploy:
      replicas: 1
      labels:
        - traefik.enable=false
      restart_policy:
        condition: any
    environment:
      MONGODB_ROOT_USER_FILE: /run/secrets/mongo_root_username_airnotifier
      MONGODB_ROOT_PASSWORD_FILE: /run/secrets/mongo_root_password_airnotifier
    secrets:
       - mongo_root_username_airnotifier
       - mongo_root_password_airnotifier

  airnotifier:
    depends_on:
      - mongodb
    image: andisugandi/airnotifier:3
    volumes:
      - /PATH_TO/airnotifier.example.com/certs:/var/airnotifier/pemdir
      - /PATH_TO/airnotifier.example.com/logs:/var/log/airnotifier
    environment:
      MONGO_USER: root
      MONGO_PASS: please-change-me
      MONGO_SERVER: mongodb
      MONGO_PORT: 27017
    networks:
      - airnotifiernetwork
      - proxy
    deploy:
      replicas: 1
      restart_policy:
        condition: any
      labels:
          - "traefik.enable=true"
          - "traefik.docker.network=proxy"
          - "traefik.http.routers.airnotifier-secure.entrypoints=websecure"
          - "traefik.http.routers.airnotifier.entrypoints=web"
          - "traefik.http.routers.airnotifier-secure.rule=Host(`airnotifier.example.com`)"
          - "traefik.http.routers.airnotifier.rule=Host(`airnotifier.example.com`)"
          - "traefik.http.routers.airnotifier-secure.service=airnotifier-service"
          - "traefik.http.routers.airnotifier-secure.tls.certResolver=letsencrypt"
          - "traefik.http.services.airnotifier-service.loadbalancer.server.port=8801"

secrets:
   mongo_root_username_airnotifier:
     external: true
   mongo_root_password_airnotifier:
     external: true

networks:
  airnotifiernetwork:
  proxy:
    external: true

Here is the logs in the progress on the deployment:

airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   | Installing AirNotifier ...
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   | Traceback (most recent call last):
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |   File "/airnotifier/./install.py", line 61, in <module>
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |     mongodb = pymongo.MongoClient(options.mongouri)
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |   File "/root/.local/share/virtualenvs/airnotifier-VNC5CTQn/lib/python3.9/site-packages/pymongo/mongo_client.py", line 680, in __init__
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |     res = uri_parser.parse_uri(
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |   File "/root/.local/share/virtualenvs/airnotifier-VNC5CTQn/lib/python3.9/site-packages/pymongo/uri_parser.py", line 496, in parse_uri
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |     user, passwd = parse_userinfo(userinfo)
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |   File "/root/.local/share/virtualenvs/airnotifier-VNC5CTQn/lib/python3.9/site-packages/pymongo/uri_parser.py", line 63, in parse_userinfo
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   |     raise InvalidURI(
airnotifier-example-com_airnotifier.1.d5y6q2nt0wrl@vm   | pymongo.errors.InvalidURI: Username and password must be escaped according to RFC 3986, use urllib.parse.quote_plus().
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_URL_REGEX: mongodb:\/\/root:please-change-me@mongodb:27017\/?
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_SERVER: mongodb
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_PORT: 27017
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_USER: root
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_PASS: please-change-me
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_PROTOCOL: mongodb
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_DATABASE: 
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_OPTIONS: 
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_URL: mongodb://root:please-change-me@mongodb:27017/?
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_URL_REGEX: mongodb:\/\/root:please-change-me@mongodb:27017\/?
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | MONGO_URL_FROM_CONFIGPY=mongodb://root:please-change-me@mongodb:27017/?
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | Installing AirNotifier ...
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | Traceback (most recent call last):
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |   File "/airnotifier/./install.py", line 61, in <module>
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |     mongodb = pymongo.MongoClient(options.mongouri)
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |   File "/root/.local/share/virtualenvs/airnotifier-VNC5CTQn/lib/python3.9/site-packages/pymongo/mongo_client.py", line 680, in __init__
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |     res = uri_parser.parse_uri(
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |   File "/root/.local/share/virtualenvs/airnotifier-VNC5CTQn/lib/python3.9/site-packages/pymongo/uri_parser.py", line 496, in parse_uri
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |     user, passwd = parse_userinfo(userinfo)
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |   File "/root/.local/share/virtualenvs/airnotifier-VNC5CTQn/lib/python3.9/site-packages/pymongo/uri_parser.py", line 63, in parse_userinfo
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   |     raise InvalidURI(
airnotifier-example-com_airnotifier.1.xeoz3q43vgal@vm   | pymongo.errors.InvalidURI: Username and password must be escaped according to RFC 3986, use urllib.parse.quote_plus().

Please help and suggestions.

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions