1.7.1 • Published 2 years ago

docker-stack-cli v1.7.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

npm.io

docker-stack-cli

The purpose of this project is to provide a CLI tool to easily dockerize any TAO instance.

current version PRs welcome built with ❤

Table of contents

Prerequisites

Installation

  • Clone this repository:
$ git clone git@github.com:oat-sa/docker-stack-cli.git
  • Enter to the cloned directory:
$ cd docker-stack-cli
  • Create a symlink to the global NPM folder:
$ npm link

Commands

create

taoDockerize create <name>

Options:

  -p, --php [php]     Optional, 7.2 by default. A required PHP FPM version.

Navigate into a folder where a TAO instance is already checked out, then run the command to create the Docker configuration files for this folder. The [name] must be a unique identifier for this project, which will become also the url, like https://[name].docker.localhost.

After the command got executed, you can find the generated configuration files in the .docker-stack-cli folder which is located in your HOME folder. For example on OSX: /Users/<username>/.docker-stack-cli

This folder contains all the generated projects, including the new one. Folder structure:

.docker-stack-cli
|-- <name>                      # name of the project
|   |-- docker
|   |   |-- nginx
|   |   |   |-- nginx.conf      # configuration file for Nginx
|   |   |-- phpfpm
|   |   |   |-- Dockerfile      # Docker image for PHP-FPM
|   |-- volume                  # this folder will get attached to the PHP-FPM container
|   |   |-- setup.json          # default setup seed file for TAO
|   |-- docker.json             # configuration file for this project
|   |-- docker-compose.yml      # project's docker containers

list

taoDockerize list

Displays a table which contains all the created projects and their current states. Options:

  -h, --help  output usage information

up

taoDockerize up

Performs a docker-compose up -d on that project which belongs to the given folder, where the command got executed. Options:

  -b, --build Start TAO instance after re-building related docker images
  -h, --help  output usage information

down

taoDockerize down

Performs a docker-compose down on that project which belongs to the given folder, where the command got executed. Options:

  -h, --help  output usage information

install

taoDockerize install

Installs the TAO in that project, which belongs to the given folder, where the command got executed. Options:

  -m, --mathjet                 Install mathjet in the environment (Pending to implement)
  -c, --customer [customer]     Enter name of the customer of your project. Only bosa, nfer and nfer111 supported.
  -u, --username [username]     Admin username (default: "admin")
  -p, --password [password]     Admin password (default: "Admin.12345")
  -e, --extension [extension]   Extensions to be installed. You can define multiple extensions like: taoMp,taoMpArt (default: "taoCe")
  -h, --help                    Output usage information

remove

taoDockerize remove

Stops the project if it's already running and removes all configuration files. Options:

 -h, --help  output usage information

Example

Let's assume you already set up docker-stack and you want to have a TAO instance which runs locally.

  • Clone the oat-sa/package-tao repository
$ git clone git@github.com:oat-sa/package-tao.git my-tao-instance
  • Navigate into the cloned repository
$ cd my-tao-instance
  • Install the dependencies with Composer
$ composer install

--ignore-platform-reqs: For fast install on development. Don't check requirements like PHP version

--prefer-source: For download directly from github repositories

  • Dockerize your project
$ taoDockerize create <my-tao-instance> [-php <version>]

It will generate the configuration files into <USER_HOME_FOLDER>/.docker-stack-cli/my-tao-instance folder. Your output should look like this:

[ LOG ]       Checking requirements...
[ LOG ]       Creating configuration files...
[ SUCCESS ]   Project successfully dockerized!

              name: "my-tao-instance"
         root path: "/Users/phalasz/work/my-tao-instance"
configuration path: "/Users/phalasz/.docker-stack-cli/my-tao-instance"
           version: "v1.0.0"


[ INFO ]      To start the docker containers, run "taoDockerize up" in this folder
[ INFO ]      To stop the docker containers, run "taoDockerize down" in this folder
[ INFO ]      To remove the configuration files, run "taoDockerize remove" in this folder
  • Run the dockerized project
$ taoDockerize up
  • Open your instance in the browser: https://my-tao-instance.docker.localhost

Alternatively you can install your TAO instance in command line. In this case you need to run the following command:

$ taoDockerize install
  • Stop your project
$ taoDockerize down
  • Remove the configuration files for your project
$ taoDockerize remove