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

No-config databases or json data storage #200

Closed
Daemach opened this issue Sep 13, 2019 · 19 comments
Closed

No-config databases or json data storage #200

Daemach opened this issue Sep 13, 2019 · 19 comments

Comments

@Daemach
Copy link

Daemach commented Sep 13, 2019

FWIW, it would be nice to remove the need for database configuration, or an extra database, by using redis, couchbase, mongodb or other nosql databases, or better yet just store/persist the data in a json file that can be stored on a volume or NFS share. Configs will not change often enough to justify a full database with its added complexity and overhead.

@talondnb
Copy link

I agree with this, it becomes a bit of a pain having to launch the containers in certain order unless I'm missing something?

@bstin
Copy link

bstin commented Oct 1, 2019

A possible solution that may be quicker to implement is just base this around sqlite? That way the db and db-engine can just be part of same container and generally be invisible to user.

@meichthys
Copy link

Has this been implemented? I can't seem to find any documentation or dev versions that have this.

@timdonovanuk
Copy link

+1 to this. A mysql database takes up 250mb+ to store the < 2kb of data required to make nginx-proxy-manager work. Absolutely nuts.

@renannprado
Copy link

I was about to try it out, but requiring a database for this purpose is a no-go for me.

I'll try out this one https://github.com/schenkd/nginx-ui it seems it doesn't require a database.

@guiguid
Copy link

guiguid commented Jul 11, 2020

+1 having mariadb for storing 99% of 10kb readonly data on embed devices make this powerfull software useless.
It also add more maintenance, less robustness, more attack surface.

@meichthys
Copy link

meichthys commented Jul 11, 2020

Most other containers that don’t need such a robust database use SQLite which exists in a single file and is quite reliable (even used by some major browsers).

Being able to migrate a single file (whether an SQLite dB or a JSON file would make things much easier when needing to migrate).

@meichthys
Copy link

@tg44 Do you know how we might be able to get a working instance using Sqlite?

@tg44
Copy link
Contributor

tg44 commented Aug 5, 2020

Heads up to this thread; Sqlite works!

Example db config; https://github.com/tg44/nginx-proxy-manager/blob/6690b7735d494820a7c0fa243dda86157bceb282/backend/config/sqlite-test-db.json

@meichthys
Copy link

@tg44 Great news! I can't wait to try this!

@meichthys
Copy link

@tg44 Do you know what a sample docker compose would look like using SQlite?

@tg44
Copy link
Contributor

tg44 commented Aug 15, 2020

My currently working compose;

version: "3"
services:
  nginx-proxy-manager:
    image: jc21/nginx-proxy-manager:github-pr-510
    restart: unless-stopped
    ports:
      # Public HTTP Port:
      - 80:80
      # Public HTTPS Port:
      - 443:443
      # Admin Web Port:
      - 81:81
    volumes:
      # Make sure this config.json file exists as per instructions above:
      - /hdd/docker/nginx-proxy-manager/config.json:/app/config/production.json
      - /hdd/docker/nginx-proxy-manager/data:/data
      - /hdd/docker/nginx-proxy-manager/letsencrypt:/etc/letsencrypt

And config json;

{
    "database": {
      "engine": "knex-native",
      "knex": {
        "client": "sqlite3",
        "connection": {
          "filename": "/data/mydb.sqlite"
        },
        "pool": {
          "min": 0,
          "max": 1,
          "createTimeoutMillis": 3000,
          "acquireTimeoutMillis": 30000,
          "idleTimeoutMillis": 30000,
          "reapIntervalMillis": 1000,
          "createRetryIntervalMillis": 100,
          "propagateCreateError": false
        },
        "migrations": {
          "tableName": "migrations",
          "stub": "src/backend/lib/migrate_template.js",
          "directory": "src/backend/migrations"
        }
      }
    }
}

I think using latest or github-develop tags should work too, and they are much safer to use than any pr tags.

@meichthys
Copy link

@tg44 Perfect. Thanks! This work for me too.
@Daemach I think we can close this issue.

@meichthys
Copy link

@tg44 The SQLite configuration works great, however i'm having troubles requesting an SSL certificate. It seems to fetch the certificate correctly, but there seems to be an issue with an SQL datetime conversion. (See #584)

@MrCaringi
Copy link

thanks @tg44 !!! it worked for me too!

@timdonovanuk
Copy link

Any idea how to migrate from an existing mysql nginx-proxy-manager install?

@tg44
Copy link
Contributor

tg44 commented Mar 2, 2021

@timdonovanuk mysql2sqlite should work well.

@timdonovanuk
Copy link

@tg44 awesome, thanks!

@ionescu77
Copy link

ionescu77 commented May 10, 2021

Thank you all!

  • been running on sqlite, with no problems (docker-compose)
  • upgrade from 3.8.0 to v2.9.2 worked with no problems
  • compose file is the standard one from docs, with DB commented-out:
    https://nginxproxymanager.com/setup/
version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    ports:
      # Public HTTP Port:
      - '80:80'
      # Public HTTPS Port:
      - '443:443'
      # Admin Web Port:
      - '81:81'
    environment:
      # These are the settings to access your db
      #DB_MYSQL_HOST: "db"
      #DB_MYSQL_PORT: 3306
      #DB_MYSQL_USER: "npm"
      #DB_MYSQL_PASSWORD: "npm"
      #DB_MYSQL_NAME: "npm"
      # If you would rather use Sqlite uncomment this
      # and remove all DB_MYSQL_* lines above
      DB_SQLITE_FILE: "/data/database.sqlite"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
#    depends_on:
#      - db
#  db:
#    image: jc21/mariadb-aria:10.4
#    restart: always
#    environment:
#      MYSQL_ROOT_PASSWORD: 'npm'
#      MYSQL_DATABASE: 'npm'
#      MYSQL_USER: 'npm'
#      MYSQL_PASSWORD: 'npm'
#    volumes:
#      - ./data/mysql:/var/lib/mysql

So I guess no need for mysql anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.