Giter Site home page Giter Site logo

dokku-edgedb's People

Contributors

dependabot[bot] avatar ignisda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dokku-edgedb's Issues

Example Deploy instruction for Wiki

Deploying an Application on Dokku with Dokku-EdgeDB Plugin

Server Installation

  1. Install Dokku.
  2. Install the Dokku-EdgeDB plugin:
sudo dokku plugin:install https://github.com/ignisda/dokku-edgedb.git edgedb
  1. Create a Dokku-EdgeDB instance:
    dokku edgedb:create lollipop

  2. Link the Dokku-EdgeDB instance to your Dokku application:
    dokku edgedb:link lollipop mydokkuapp

Deploying an Application on Local Dev to Dokku VPS Using Dokku-EdgeDB

  1. Deploy your local development application to the Dokku server by adding Dokku to your remote Git.
  2. Add your Dockerfile
    example I used for a react node.js application:
# Base node image.
FROM node:18-bullseye-slim as base
RUN apt-get update && apt-get install -y openssl curl

RUN npm install -g npm@latest

# Install all node_modules, including dev dependencies.
FROM base as deps

WORKDIR /app
ADD package.json package-lock.json .npmrc ./
RUN npm install

# Setup production node_modules.
FROM base as production-deps

WORKDIR /app
RUN rm -rf /app/node_modules /app/node_modules
COPY --from=deps /app/node_modules /app/node_modules
ADD package.json package-lock.json .npmrc ./
RUN npm prune --production

# Build the app
FROM base as build

WORKDIR /app

COPY --from=deps /app/node_modules /app/node_modules

# Run the typescript generators
ADD . ./
RUN npm run build

# Production build
FROM edgedb/edgedb as downloader
FROM base
COPY --from=downloader /usr/bin/edgedb /usr/bin/edgedb

WORKDIR /app
COPY --from=production-deps /app/node_modules /app/node_modules
COPY --from=build /app/build /app/build
COPY --from=build /app/public /app/public
COPY --from=build /app/dbschema/migrations /app/dbschema/migrations
COPY --from=build /app/start.sh /app/start.sh
ADD . ./

IMPORTANT:
we need the edgedb-cli to connect to our dokku-edgeb plugin container to run the migrations that are in our dokku application container. The Dockerfile adds these.


Now create a Procfile in the root of your application:

release: edgedb migration apply

Add a domain to the application and a subdomain for the EdgeDB admin ui.

  1. dokku domains:add <mydomain.com>
  2. dokku domains:add <ui.myapp> <mydomain.com> where ui is the subdomain you will be accessing your edgeDB admin ui from.

Enable the admin UI with the new plugin command

To easily inspect our edgedb database and its data for debugging and testing purposes we enable the admin ui ( after succesfull deploy ) the steps to do this is:

  1. run the command add here
  2. add a subdomain DNS to your mydomain.ltd
  3. other steps

dokku edgedb:upgrade nightly fails

 !     Edgedb service nightly does not exist
root@ubuntu-s-1vcpu-2gb-amd-fra1-01:~# dokku edgedb:upgrade training nightly
=====> Upgrading training to edgedb/edgedb:2.11
=====> Stopping training
=====> Pausing container
       Container paused
       Removing container
=====> Starting container
       Waiting for container to be ready
       Linking edgedb instance
[2023-03-15T11:11:52Z WARN  edgedb::version_check] Newer version of edgedb tool exists 2.3.1+ef99779 (current 2.2.6+b869667)
Trusting unknown server certificate: SHA1:___XXX___
/.config/edgedb/credentials/training.json exists! Overwrite? (type `Yes`)
edgedb error: EOF```

dokku edgedb:connect

This seems to 'work':

root@ubuntu-s-1vcpu-2gb-amd-fra1-01:~# dokku edgedb connect training
usage: dokku edgedb:connect <service>

connect to the service via the edgedb connection tool

arguments:

service   service to run command against

examples:

connect to the service via the edgedb connection tool

    > NOTE: disconnecting from ssh while running this command may leave zombie processes due to moby/moby#9098

    dokku edgedb:connect lollipop

root@ubuntu-s-1vcpu-2gb-amd-fra1-01:~#
**usage: dokku edgedb:connect <service>**

but dokku edgedb:connect training

gives this output instead:

EdgeDB CLI
Use the edgedb command-line tool to spin up local instances, manage EdgeDB projects,
create and apply migrations, and more.

Running edgedb without a subcommand opens an interactive shell.

USAGE:
    edgedb [OPTIONS] [SUBCOMMAND]

OPTIONS:
        --help-connect           Print all available connection options for the
                                 interactive shell and subcommands
    -V, --version                Show command-line tool version
        --no-cli-update-check    Disable checking if a new version of CLI is available
    -h, --help                   Print help information

CONNECTION OPTIONS (edgedb --help-connect to see the full list):
    -I, --instance <instance>
            Local instance name created with edgedb instance create to connect to
            (overrides host and port)

        --dsn <dsn>
            DSN for EdgeDB to connect to (overrides all other options except password)

        --credentials-file <credentials_file>
            Path to JSON file to read credentials from

SUBCOMMANDS:
    dump                         Create a database backup
    restore                      Restore a database backup from file
    configure                    Modify database configuration

    migration apply              Bring current database to the latest or a specified
                                 revision
    migration create             Create a migration script
    migration status             Show current migration state
    migration log                Show all migration versions
    migration edit               Edit migration file

    migrate                      An alias for edgedb migration apply

    database create              Create a new DB

    describe object              Describe a database object
    describe schema              Describe schema of the current database

    list                         List matching database objects by name and type
    query                        Execute EdgeQL queries
    ui                           Launch the web UI for the EdgeDB instance
    info                         Show information about the EdgeDB installation

    project init                 Initialize a new or existing project
    project unlink               Clean-up the project configuration
    project info                 Get various metadata about the project
    project upgrade              Upgrade EdgeDB instance used for the current project

    instance create              Initialize a new EdgeDB instance
    instance list                Show all instances
    instance status              Show status of a matching instance
    instance start               Start an instance
    instance stop                Stop an instance
    instance restart             Restart an instance
    instance destroy             Destroy an instance and remove the data
    instance link                Link a remote instance
    instance unlink              Unlink a remote instance
    instance logs                Show logs of an instance
    instance upgrade             Upgrade installations and instances
    instance revert              Revert a major instance upgrade
    instance reset-password      Reset password for a user in the instance
    instance credentials         Echo credentials to connect to the instance

    server                       Manage local EdgeDB installations

    cli upgrade                  Upgrade the 'edgedb' command-line tool```

Enable/disable admin UI and printout the admin URL.

It would be great if one could expose the edgedb admin UI with a command for the plugin.

Since the admin UI can be enabled and disabled the command should probably just enable or disable it and if enabled show the admin UI URL in the console so you can easily bookmark it for usage.

One can then manually set firewall rules to prevent the admin UI to be accessible to the world.

Perhaps, its possible to set the admin URL to a fixed Port so you would not need to change your firewall rules each time.
In the case there are multiple edgedb instances on the same dokku server it would be, if possible perhaps be a good idea to increment the port numbers the edgedb UI runs on.

Say a "Wise" default would be port 9000
then edgedb instance #1 would be at port 9000
then edgedb instance #2 would be at port 9001

This way it would be easily managable.

Something like:

dokku edgedb:admin enable
dokku edgedb:admin disable

Setting firewall should be probably be managed outside of the plugin, in my case I use DigitalOcean to set firewall rules on my VPS.

Extend backup solution with locale filestorage

If im correct reading the docs currently only S3 backups are possible?

A proposal to extend the backup feature with 2 small additions.

  1. Local storage on the server where dokku runs on ( outside the container ) encrypted.
  2. Option to use SCP to copy database backup securely to a remote file server.

Would this plugin also work for nightly build version of edgedb?

Firstmost thank you very much for creating this plugin,
is it considered stable enough to use in a simple MVP application on production for now?

Im testing the nightly build of edgedb, and wonder if this works or i have to specify the nighty build when creating a new instance of edgedb with this plugin.

Solution to monitor EdgeDB instance

Here a short proposal for a way to enable monitoring for EdgeDB.

https://www.edgedb.com/docs/guides/deployment/health_checks#ref-guide-deployment-health-checks

Perhaps there could be some easy way to enable monitoring and integrate with an opensource solution like:
https://novu.co
or other push notification implementation so you recieve a warning when there are problems with the edgedb instance.

Not sure if this is a good proposal but it seems to be the only missing thing to make this perfect.
Perhaps Its outside of the scope of the plugin but thought I share this final thought.

Fix inconsistent hosts shown

The host that is displayed in the database url and the one that is actually made available to the apps are different. For eg the host in EDGEDB_DSN will be like dokku-edgedb-test and the host made available to the app will be edgedb.

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.