chrisvel / wreeto_official

Wreeto is an open source note-taking, knowledge management and wiki system.
https://wreeto.com
GNU Affero General Public License v3.0
387 stars 13 forks source link

Defined DB name is not considered #32

Closed hibare closed 4 years ago

hibare commented 4 years ago

I have defined a different DB name in environment variable and created corresponding DB in postgres but still wreeto is looking for wreeto-dev db.

Is this behaviour expected? Is wreeto ready for production deployment?

hibare commented 4 years ago

Sample log:

wreeto    | Caused by:
wreeto    | PG::ConnectionBad: FATAL:  database "wreeto_dev" does not exist
wreeto    | /usr/local/bundle/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
wreeto    | /usr/local/bundle/gems/pg-1.2.3/lib/pg.rb:58:in `new'
wreeto    | /usr/local/bundle/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
wreeto    | /usr/local/bundle/gems/activerecord-5.2.4.3/lib/active_record/connection_

Corresponding docker-compose.yml snippet

    environment:
      POSTGRES_DB: wreeto
      POSTGRES_HOST: postgres
chrisvel commented 4 years ago

@hibare you shouldn't use the docker-compose.yml file in order to set the variables.

Check out the .env setup section in the Readme file https://github.com/chrisvel/wreeto_official#41-set-up-your-environment.

You should use the .env file to add them. Please try this and let me know.

hibare commented 4 years ago

Docker-compose will load .env file content as the same way directly defining them in yml file. Doing docker-compose config will show the results

chrisvel commented 4 years ago

You can't load the .env file with the POSTGRES_DB variable set up and at the same time insert the same variables in the docker-compose.yml as you did:

  environment:
      POSTGRES_DB: wreeto
      POSTGRES_HOST: postgres

The .env variables override the ones you mentioned.

You must follow the provided instructions to only setup your database variables through the .env file and remove them from the docker-compose.yml.

Let me know If this works.

hibare commented 4 years ago

I'm not loading .env and also defining environment variables directly. I'm doing only one, directly defining environment variables in docker-compose.yml file. Just for side note, I re-wrote entire file as per my needs.

hibare commented 4 years ago

Here is complete file

version: "3.7"

services:

  wreeto:
    image: chrisvel/wreeto:latest
    container_name: wreeto
    environment:
      REDIS_HOST: ${REDIS_HOST}
      POSTGRES_HOST: ${POSTGRES_HOST}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_PORT: ${POSTGRES_PORT}
      RACK_ENV: ${RACK_ENV}
      RAILS_ENV: ${RAILS_ENV}
      REDIS_HOST: ${REDIS_HOST}
      REDIS_PASSWORD: ${REDIS_PASSWORD}
      WREETO_HOST: ${WREETO_HOST}
      WREETO_PORT: ${WREETO_PORT}
      SMTP_USERNAME: ${SMTP_USERNAME}
      SMTP_PASSWORD: ${SMTP_PASSWORD}
    volumes:
      - ./data/wreeto/public/assets:/app/wreeto/public/assets
      - ./data/wreeto/app:/app/wreeto
    networks:
      - proxy
      - backend_db
    restart: unless-stopped
    labels:
      - traefik.enable=true
      - traefik.docker.network=nw_proxy
      - traefik.http.routers.portainer.rule=Host(`wreeto.${BASE_DOMAIN_MGMT}`)
      - traefik.http.routers.portainer.tls=true
      - traefik.http.routers.portainer.tls.certresolver=le
      - traefik.http.services.portainer.loadbalancer.server.port=8383

networks: 
  backend_db:
    external:
      name: nw_backend_db
  proxy:
    external:
chrisvel commented 4 years ago

@hibare I'm sorry about this. I have pushed a new version to docker hub that should solve your issue.

Can you please pull and retry and let me know ?

hibare commented 4 years ago

Thanks @chrisvel ...

I'll try and let you know.

chrisvel commented 4 years ago

Resolving this issue for now, as there is no activity for the past 15 days.