GithubHelp home page GithubHelp logo

PostgreSQL go driver about acme-dns HOT 8 CLOSED

joohoi avatar joohoi commented on September 25, 2024
PostgreSQL go driver

from acme-dns.

Comments (8)

joohoi avatar joohoi commented on September 25, 2024

The PgSQL driver is baked in the acme-dns itself, so there's no need to install your own. Your issue seems to be that the database engine option in the config file seems to be empty (or commented out):

It should be:

...
[database]
# Database engine to use, sqlite3 or postgres
engine = "postgres"
...

from acme-dns.

sh511 avatar sh511 commented on September 25, 2024

Thank you for pointing out that the driver is embedded in the binary. I forgot to check under the vendor folder.

Regarding my config.cfg file I do have engine="postgres" specified. The file is in /etc/acme-dns and owned by acme-dns:acme-dns as per service file.

I get the same error if I run acme-dns directly

INFO[0000] Using config file file=/etc/acme-dns/config.cfg
ERRO[0000] Could not open database [sql: unknown driver "" (forgotten import?)]

Actually it does not matter what string I use in the config file, even
engine = "nonsense"
I get the same error unknown driver "" (i.e. empty string).

Completely confused ...

from acme-dns.

joohoi avatar joohoi commented on September 25, 2024

The error message implies that the engine value within [database] block couldn't be read for some reason. I wonder if you might have commented the [database] block out or something? Anyway acme-dns is unable to read the value of engine configuration variable for reason or another.

from acme-dns.

sh511 avatar sh511 commented on September 25, 2024

After learning how to get around in GOLANG, I tracked down the issue. I had left out the quotes around the ip parameters. Since util.go does not check for errors in toml.DecodeFile, because it "Practically never errors" 8-), the error was not caught and no parameters was returned in Config then resulting in the "" driver error. So I would suggest not to assume that users will not make an error while editing the config file.

Also, if the permissions are not set properly on the config file, the os.Stat check in fileExists will not flag a file that exists but cannot be read. Using os.Open and checking for an error is more reliable (then closing the file is there is no error). There might be a more GOLANG way of doing the same.

from acme-dns.

joohoi avatar joohoi commented on September 25, 2024

Ah, most awesome that you got it to work!

Since util.go does not check for errors in toml.DecodeFile, because it "Practically never errors" 8-),

Burn! I'm very sorry that the sloppy error handling did bite you :/

This definitely is a bug, and should get fixed. As you dug into the code already, would you like to submit a PR to fix the issue? If not, I'll do it.

from acme-dns.

sh511 avatar sh511 commented on September 25, 2024

Finally got around submitting a PR. Just did a bit more testing not to introduce new features. I think that the documentation should direct the user to always place the configuration file in /etc/acme-dns/ if running as a service and non-privileged user acme-dns. I am not sure what the "current" directory is for a service.

Also regarding the configuration file, I would suggest including the ip:port option and not only the :port option for listen, e.g.

Edit the following line to the ip address that acme-dns is listening to

#listen = "198.51.100.1:53"

If acme-dns is listening to all addresses on the server, use

listen = ":53"

Since I am running acme-dns along the "main" DNS server, I needed to specify separate IP addresses to listen to. Rather obvious in retrospect but a note in the configuration file would be useful.

from acme-dns.

LinuxCuba avatar LinuxCuba commented on September 25, 2024

This is my conf referent to database
[database]

Database engine to use, sqlite3 or postgres

engine = "sqlite3"

Connection string, filename for sqlite3 and postgres://$username:$password@$host/$db_name for postgres

connection = "/var/lib/acme-dns/acme-dns.db"
The problem is persistent

from acme-dns.

joohoi avatar joohoi commented on September 25, 2024

The error messages should be a lot better now when #99 and #101 have landed to reveal the underlying issue.

from acme-dns.

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.