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

Volume postgres vazio #8

Open
gustavoninetyone opened this issue Feb 28, 2022 · 4 comments
Open

Volume postgres vazio #8

gustavoninetyone opened this issue Feb 28, 2022 · 4 comments

Comments

@gustavoninetyone
Copy link

gustavoninetyone commented Feb 28, 2022

- ./wppconnect-chatwoot/data/postgres:/var/lib/postgresql/data

Prezados, e correto criar a a base a "chatwoot_production" na "mão"? Pergunto isso por que a inicialização do postgres esta dando erro pois o volume esta vazio.

@gustavoninetyone
Copy link
Author

gustavoninetyone commented Feb 28, 2022

Pessoal depois de entender que o rails precisa preparar as bases, a correção é muito simples. Basta alterar o comando abaixo:

command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0']

por:

    command: sh -c "
        bundle exec rails db:chatwoot_prepare &&
        bundle exec rails s -p 3000 -b 0.0.0.0"

Assim as bases serão preparadas sem a necessidade de executar comandos anteriores.

Caso obtenha sucesso nos testes. Podem fechar a issue.
Estou à disposição!

@gustavoninetyone
Copy link
Author

Caso ajude alguém, segue meus volumes criados e meu docker-compose e

docker volume create --driver local \
    --opt type=none \
    --opt device=wppconnect-chatwoot/postgres \
    --opt o=bind chatwoot_postgres
docker volume create --driver local \
    --opt type=none \
    --opt device=wppconnect-chatwoot/redis \
    --opt o=bind chatwoot_redis
docker volume create --driver local \
    --opt type=none \
    --opt device=/wppconnect-chatwoot/pgadmin \
    --opt o=bind chatwoot_pgadmin

Obs: Criei um volume do pgadmin para gerenciar melhor os arquivos de area de transferencia. Isso por que ele guarda o backups e quaisquer outros arquivos de download/upload em /storage

version: '3'

services:
  base: &base
    image: chatwoot/chatwoot:develop
    container_name: chatwoot
    hostname: lchatwoot
    env_file: .env 
    stdin_open: true 
    tty: true  
    networks: 
      - wpp-network     
  rails:
    <<: *base
    container_name: chatwoot-rails
    hostname: chatwoot-rails
    depends_on:
      - postgres
      - redis
    environment:
      - NODE_ENV=production
      - RAILS_ENV=production
    networks: 
      - wpp-network
    entrypoint: docker/entrypoints/rails.sh
    command: sh -c "
        bundle exec rails db:chatwoot_prepare &&
        bundle exec rails s -p 3000 -b 0.0.0.0"

  sidekiq:
    <<: *base
    container_name: chatwoot-sidekiq
    hostname: chatwoot-sidekiq
    depends_on:
      - postgres
      - redis
    environment:
      - NODE_ENV=production
      - RAILS_ENV=production
    networks: 
      - wpp-network
    restart: unless-stopped
    command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml']

  postgres:
    image: postgres:12
    container_name: chatwoot-postgres
    hostname: chatwoot-postgres
    restart: always
    volumes:
      - chatwoot_postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=chatwoot
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=chatwoot
    networks: 
      - wpp-network
  
  pgadmin:
    image: dpage/pgadmin4:latest
    container_name: chatwoot-pgadmin4
    hostname: chatwoot-pgadmin4
    ports:
      - "8087:80" #pgadmin
    volumes:
      - chatwoot_pgadmin:/var/lib/pgadmin ## Area de Transferencia pgAdmin upload/download
    environment:
      PGADMIN_LISTEN_ADDRESS: "0.0.0.0"
      PGADMIN_DEFAULT_EMAIL: "[email protected]"
      PGADMIN_DEFAULT_PASSWORD: "PgAdmin2021!"
    depends_on:
      - postgres
    networks:
      - wpp-network

  redis:
    image: redis:alpine
    container_name: chatwoot-redis
    hostname: chatwoot-redis
    restart: always
    command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]
    env_file: .env
    volumes:
      - chatwoot_redis:/data
    networks: 
      - wpp-network

  wppconnect-server:
    build: 
      context: ./wppconnect-server
      dockerfile: Dockerfile
    restart: always
    image: wppconnect-server
    container_name: wppconnect-server
    hostname: wppconnect-server
    entrypoint: docker-entrypoint.sh yarn start
    networks: 
      - wpp-network
    tty: true

  nginx:
    build: 
      context: ./wppconnect-nginx
      dockerfile: Dockerfile
    container_name: nginx
    entrypoint: nginx -g "daemon off;"
    ports:
      - "8080:8080" #chatwoot
      - "8081:8081" #wppconnect
      - "8082:8082" #pgadmin
      - "8083:8083" #redis
    networks: 
      - wpp-network
    depends_on:
      - wppconnect-server

volumes:
  chatwoot_postgres:
    external: true
  chatwoot_redis:
    external: true
  chatwoot_pgadmin:
    external: true

networks: 
  wpp-network:
    name: wpp-network
    driver: bridge

@renat473
Copy link
Contributor

renat473 commented Feb 4, 2023

olá,

Obrigado pela sua contribuição, a issues será encerrado caso tenha problemas novamente favor abrir uma nova.

@EUrubatan
Copy link

Se vc estiver usando ubuntu server, pode ser que seu usuario não tem permisão na pasta e por isso não aparece.
eu tambem fiquei oensando isso. depois de meio dia descobri kkkkkk

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

3 participants