@randombenj/dbsync
TypeScript icon, indicating that this package has built-in type declarations

1.10.2-alpha.0 • Public • Published

LXDHUB DBSYNC Logo

Display, search and copy LXD images using a web interface.

Gitter Circle CI Status npm version npm downloads

Database

LXDHub DBSync uses a PostgreSQL database to store its data. You must set up a PostgreSQL on your local machine or inside a docker container

Using Docker

docker run -p 5432:5432 \
           -e POSTGRES_USER=lxdhub \
           -e POSTGRES_DB=lxdhub \
           -e POSTGRES_PASSWORD=lxdhub \
           -v db:/var/lib/postgresql/data \
           -d --name db postgres:10.2

NodeJS

CLI

npm install -g @lxdhub/dbsync

# Run locally
lxdhub-dbsync start -c ./lxdhub.yml --cert certificates/client.crt --key certificates/client.key

Programmatically

npm install -s @lxdhub/dbsync

Example usage in NodeJS

const { LXDHubDbSync } = require('@lxdhub/dbsync');
const fs = require('fs');
const path = require('path');

const ROOT = path.join(__dirname, '..');

const certPath = path.join(ROOT, 'certificates/client.crt');
const keyPath = path.join(ROOT, 'certificates/client.key');
const lxdhubConfig = path.join(ROOT, 'lxdhub.yml');

LXDHubDbSync.run({
    lxdhubConfig,
    lxd: {
        cert: fs.readFileSync(certPath),
        key: fs.readFileSync(keyPath)
    },
    database: {
        host: 'localhost',
        port: 5432,
        username: 'lxdhub',
        password: 'lxdhub',
        database: 'lxdhub'
    }
});

Docker

LXDHub supports Docker. You can pull the latest version using the brunnel6/lxdhub-dbsync:latest tag or a specific version e.g. brunnel6/lxdhub-dbsync:1.0.0

docker pull brunnel6/lxdhub-dbsync:latest
docker run -v "$(pwd)/certificates:/var/lib/lxdhub/certificates" \
           -v "$(pwd)/lxdhub.yml:/var/lib/lxdhub/lxdhub.yml" \
           -p 3000:3000 \
           -e POSTGRES_HOST=postgres \
           --link db:postgres \
           brunnel6/lxdhub-dbsync:latest

Readme

Keywords

Package Sidebar

Install

npm i @randombenj/dbsync

Weekly Downloads

3

Version

1.10.2-alpha.0

License

Apache-2.0

Unpacked Size

197 kB

Total Files

214

Last publish

Collaborators

  • randombenj