1.0.0 • Published 8 years ago

dokku-gulp-tasks v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Dokku gulp tasks

A few opinionated gulp.js tasks for speeding-up deployment with Dokku.

These tasks assume the following about your environment:

  • Your application uses MySQL
  • You're running Dokku v0.4.14 or later, and using the official MySQL plugin
  • You have SSH keys set up for the dokku user
  • You're running in a Vagrant machine, with the root of your application shared at /vagrant
  • You have an existing gulpfile.babel.js

Getting started

  1. Install the package to your project with npm install --save dokku-gulp-tasks
  2. Require the package in your gulpfile.js, and pass it an instance of gulp:

    // ES2015-style
    import deployTasks from 'dokku-gulp-tasks';
    deployTasks(gulp);
    
    // CommonJS-style
    require('dokku-gulp-tasks')(gulp);
  3. Create a env.json (see example) in the root of your project to describe the local database credentials, and remote Dokku server(s).

    You can override the shared directory with the sharedDirectory parameter:

    // env.json
    {
      "sharedDirectory": "/home/vagrant"
    }

    You can force the scripts to expect to be run in the context of a Vagrant machine (versus the host machine) by setting isVagrantContext:

    // env.json
    {
      "isVagrantContext": true
    }

    By default, the script will check if the user who invoked it matches vagrant to determine the context.

Usage

gulp dokku [--command <command>] [--env <env>]

Deployment

The dokku task allows you to run arbitrary Dokku commands, specified in the command argument (for example, gulp dokku apps will list the apps deployed to the server). If you have multiple Dokku servers specified in env.json, you can specify an environment by key with the env argument.

gulp dokku:init [--env <env>]

Readies the Dokku server for deployment of the app by performing the following tasks:

  • Creates a new app
  • Creates a MySQL container
  • Links the app and MySQL containers
gulp dokku:remote [--env <env>]

Creates a git remote for the Dokku server. This task is run automatically by dokku:init, but is useful for adding a remote for an app that was initialized by another developer.

gulp dokku:deploy [--env <env>]

Deploys the application by pushing the current branch to the Dokku server.

Databases

gulp db:dump-local [--env <env>]

Dumps the database from the local Vagrant machine to the .tmp directory.

gulp db:dump-remote [--env <env>] [--mariadb]

Dumps the database of the remote Dokku app to the .tmp directory. The mariadb flag provides legacy support for Kloadut's Dokku MariaDB plugin.

gulp db:push [--env <env>] [--mariadb]

Pushes the database from the local Vagrant machine to a remote Dokku app.

gulp db:pull [--env <env>] [--mariadb]

Pulls the database of the remote Dokku app to the local Vagrant machine.

gulp db:backup [--env <env>] [--mariadb]

Creates timestamped dumps of the databases from both the local Vagrant machine, and the remote Dokku app to the /databases directory.

1.0.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago