Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  bin
  src
  templates
  vendor
  .gitignore
  README.md
  composer.json
  composer.lock
  melt-deploy.sh
  melt-pull-db.sh
  melt-pull-files.sh
  melt-push-db.sh
  melt-push-files.sh
Size: Mime:
  README.md

melt Console

melt Console is a command line utility that leverages the wonderful Symfony Console. It offers quite a few commands to help developers interact with the remote server.

Composer setup

We created meltconsole as a public package stored on Gemfury so we could leverage composer to install it as a dependency for our projects.

  1. Add meltmedia's gemfury composer repo to your composer.json
    composer config repositories.meltmedia composer https://php.fury.io/meltmedia/
    
  2. Add meltconsole as a dependency
    composer require meltmedia/meltconsole
    

LOCAL setup

  1. Make sure you have the development.pem file added to your ~/.ssh/ directory. See https://confluence.meltdev.com/display/CP/Development+Server+SSH+Key
  2. Run melt:setup-local meltconsole command
    vendor/bin/meltconsole melt:setup-local
    
    This will create a .lando.local.yml file that will contains configuration that meltconsole uses. This file should be added to the .gitignore. It also creates a .lando.base.yml yml file that contains some global defaults.

SERVER setup

The following steps in this section require it be done on the server.

Install meltconsole globally

Log into the server and run

composer global config repositories.meltmedia composer https://php.fury.io/meltmedia/
composer global require meltmedia/meltconsole

To update meltconsole after it's installed globally, run:

composer global update meltmedia/meltconsole

Add environment variables to ~/.bash_profile

Top secret credentials should be stored in environment variables and not committed to git. Here are the current environment variables that melt console uses:

export MELT_DB_USER=''
export MELT_DB_PASS=''
export MELT_ENV='aws'

Add .meltconsole directory

@TODO

Commands

melt:create-environment

Alias: melt:ce

If you've used Pantheon before, this option is similar to their multi-dev environment feature. This allows developers to spin up a new environment in isolation from other environments so they don't have to worry breaking prod.

Some common environments are dev, qa, stage, or uat, however you can name them whatever you want.

Example

lando meltconsole melt:ce --env=dev

If you don't pass the --env flag, you will be prompted to enter an environment name.

melt:remove-environment

Alias: melt:re

Just as easy as it is to create an environment, it's as easy to remove an environment with this command. T

Example

lando meltconsole melt:re --env=pr25

If you don't pass the --env flag, you will be prompted to enter an environment name.

melt:setup-local

Alias: melt:sl

Generates the following files:

  • .lando.base.yml
  • .lando.local.yml (add to .gitignore file)
  • docroot/sites/default/settings/local.settings.php (add to .gitignore file)

melt:setup-server

Alias: melt:ss

This command is ONLY ran on the server. It creates nginx config files and generates an SSL certificate using LetsEncrypt.

melt:pull-database

Alias: melt:pulld

Pulls database from remote environment to local.

melt:push-database

@TODO

melt:pull-files

Alias: melt:pullf

Pulls files from remote environment to local

melt:push-files

@TODO

melt:deploy-code

Alias: melt:dc

Deploys code to remote environment

Creating new commands

New commands can be created by adding new classes to the src/App/Commands directory. All commands SHOULD extend the MeltCommand.php class because it contains a bunch of different helper methods. After the class has been created, you'll need to instantiate the command in the bin/meltconsole file. e.g.:

use MeltConsole\App\Commands\AwesomeNewCommand;

$app->add(new AwesomeNewCommand());

Development

To add/update/delete features for meltconsole, the code is stored under meltmedia's gemfury account. If you don't have a gemfury account, ask one of our devops peeps to add you. After that:

  1. Add the gemfury git repo as a remote:
    git remote add fury https://git.fury.io/meltmedia/meltconsole.git
    
  2. Once the remote has been added, you can then commit to the repo:
    git push fury master
    
  3. Versions are based on git tags. So if we're on v1.0.0 and we need to update the version to v1.1.0, we run:
    git tag -a v1.1.0 -m="v1.0.0"
    git push fury v1.1.0
    

DEV TODOS/QUESTIONS

How temporary is this? Are switching to Fargate soon?

  • We know ssh isn't supported in Fargate, but we may be able to leverage modules for storing files on s3 and backup up the database somewherE?

Composer issues

You may be wondering, why are the dependencies for meltconsole in a suggest object rather than using the require. Well because, we're using the latest version of Symfony v4 whereas Drupal is using v3. We run into conflicts when running composer install since Drupal 8 requires v3. This a temporary fix for now.