Coder Social home page Coder Social logo

Comments (9)

nickhammond avatar nickhammond commented on August 29, 2024

@dorianmariecom Is your database an accessory? What's the accessory config for this in your deploy.yml?

from kamal.

dorianmariecom avatar dorianmariecom commented on August 29, 2024

Here is my accessory config:

accessories:
  db:
    image: postgres:16.1
    host: 45.55.196.152
    port: 5432
    env:
      clear:
        POSTGRES_USER: code
        POSTGRES_DB: code_production
      secret:
        - POSTGRES_PASSWORD
    directories:
      - data:/var/lib/postgresql/data

from kamal.

nickhammond avatar nickhammond commented on August 29, 2024

@dorianmariecom It's prompting for the value you have set for POSTGRES_PASSWORD which would be in your .env file.

from kamal.

dorianmariecom avatar dorianmariecom commented on August 29, 2024

When I enter my database password I get: psql: error: FATAL: password authentication failed for user "code"

Doing psql postgresql://code:[email protected]/code_production works

from kamal.

dorianmariecom avatar dorianmariecom commented on August 29, 2024

When I do kamal app exec -i "echo \$HOST" I get nothing, but if I do kamal app exec -i "printenv" I get all my env variables

from kamal.

djmb avatar djmb commented on August 29, 2024

I'm not sure there's much we can do to debug this issue here, unless you have some extra information that points to this being a Kamal issue.

You could open a bash shell with kamal app exec -i bash and see if you can work anything more out from in there? I'll close this for now, but if you do find something let us know!

from kamal.

dorianmariecom avatar dorianmariecom commented on August 29, 2024

The environment variables are there with bash but still it asks me for a password even though it's in the DATABASE_URL

~/s/d/code> kamal app exec -i bash
Get most recent version available as an image...
Launching interactive command with version latest via SSH from new container on 164.92.135.114...
root@6655aa5d198f:/rails# echo $HOST
code.dorianmarie.com
root@6655aa5d198f:/rails# bin/rails dbconsole
I, [2024-03-07T04:21:55.633339 #7]  INFO -- : [dotenv] Loaded .env.production
Password for user code: 

from kamal.

djmb avatar djmb commented on August 29, 2024

You might need rails dbconsole -p:

rails dbconsole -h
Usage:
  bin/rails dbconsole

Options:
  -e,   [--environment=ENVIRONMENT]                    # The environment to run `dbconsole` in (e.g. test / development / production).
  -p,   [--include-password], [--no-include-password]  # Automatically provide the password from database.yml
        [--mode=MODE]                                  # Automatically put the sqlite3 database in the specified mode
                                                       # Possible values: html, list, line, column
        [--header], [--no-header]
  --db, [--database=DATABASE]                          # Specify the database to use.

Start a console for the database specified in config/database.yml

from kamal.

dorianmariecom avatar dorianmariecom commented on August 29, 2024

yeah that works, had no idea about the -p option, probably should be the default

from kamal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.