1.3.0 • Published 4 years ago

@imec-apt/duxis-cltools v1.3.0

Weekly downloads
14
License
UNLICENSED
Repository
github
Last release
4 years ago

duxis-cltools

Duxis project command line development tools.

See also:

Using the cltools in your Duxis Project

Add the duxis-cltools as a dependency in the package.json file in your Duxis project:

{
  "name": "my-duxis-project",
  "version": "0.1.0",
  "dx_version": "1.27.4",
  "dependencies": {
    "@imec-apt/duxis-cltools": "1.2.1"
  }
}

Cd in your Duxis project root and learn more about the dx commands with:

./dx help

Installing Auto-Completion

Auto-completion for the dx command is or can be installed on MacOS and Linux.

For MacOS, auto-completion support assumes that you installed bash auto-completion as instructed in this how-to article.

For Linux, move tmp_bash_completion.d/dx to /etc/bash_completion.d/dx:

sudo mv <path-to-package>/tmp_bash_completion.d/dx /etc/bash_completion.d/dx

e.g.:

sudo mv node_modules/@imec-apt/duxis-cltools/tmp_bash_completion.d/dx /etc/bash_completion.d/dx

Pull requests that add support for other platforms are more than welcome!

Test the cltools

Run the tests once:

npm test
yarn test

Or run the tests in watch-mode:

npm run test:watch
yarn test:watch

Local Development

To test your local version of cltools in a Duxis project, cd into the project's root directory and execute:

rm -f dx
ln -s <path-to-duxis-cltools>/dx.sh dx

To restore the project, execute:

rm -f dx
npm install
yarn install

Manual

The duxis-cltools provides the command line utility dx, which facilitates the development, testing and deployment of Duxis projects.

To develop, test or deploy a Duxis project, you first need to build the project with the dx build command. You can build in one of the four following modes. The DX_ENV columns shows the value for the DX_ENV environment variable in

CommandModeDX_ENVNODE_ENVDescription
./dx buildProductionprodproductionThe default mode for deployment.
./dx build --devDevelopmentdevdevelopmentThe standard development mode.
./dx build --dxdevDuxis-developmentdxdevdevelopmentTo be used when co-developing Duxis Foundation. (1)
./dx build --testTesttest (prod(2))testTo be used for running the tests.
./dx build --dxtestTesttest (dxdev(2))testTo be used for running the tests when co-developing Duxis Foundation.

The following table shows the values for the NODE_ENV and DX_ENV environment variables for each of the standard Duxis project modes.

ModeNODE_ENVDX_ENV
productionproductionprod
test/dxtesttesttest
developmentdevelopmentdev
dxdevdevelopmentdxdev

Once you've built in one of these modes, you can use the other commands, depending on the mode, as shown in the following table:

Commandprodde/dxdevtest/dxtestDescription
./dx upXXStart the services.
./dx testXRun the tests.
./dx inspectXXInspect a service.
./dx logsXPrint the logs.
./dx stopXXStop the services.
./dx downXXStops containers and removes containers, networks, volumes and images created when running ./dx up (or ./dx test).
./dx restartXXStop and restart the services.
./dx cleanXXXRemove all images, containers, etc.
./dx clean --testXRemove only test images, test containers, test volumes, etc.

You can also use certain commands on one (or several) services, as shown in the following examples:

CommandDescription
./dx build fooBuild the service foo in prodution mode. (1)
./dx build foo barBuild the services foo and bar in prodution mode. (1)
./dx build --dev fooBuild the service foo in development mode. (1)
./dx up foo barStart the services foo and bar.
./dx restart foo barStart the services foo and bar.
./dx logs fooPrint the logs for the service foo.
./dx stop foo barStop the services foo and bar.

Individual services should be built in the same mode as the last project build.

Some commands can only be used on a single service:

CommandDescription
./dx inspect fooInspect the service foo (after it has been started).
./dx watch fooStart the service foo in watch-mode.
./dx test --watch fooTest the foo service in watch-mode.

Duxis Project Requirements

This section is under construction...

The following files and directories are required (or optional) in a Duxis project.

PathPurpose
.envProvides default values for (most of) the environment variables. Some additional variables are set by the dx cli.
dc.base.ymlOptional Docker Compose file that typically provides the common configuration, and is extended in the environment-specific compose files.
dc.dev.ymlThe Docker Compose file that provides the development-specific configuration.
dc.dxdev.ymlOptional Docker Compose file that provides the extended Duxis-development configation.
dc.prod.ymlThe Docker Compose file that provides the production-specific configuration.
dc.test.ymlThe Docker Compose file that provides the test configuration.
...(TODO)
1.3.0

4 years ago

1.2.1

5 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.6

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago