Commit 1d8d555e authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request redmic-project/docker/docker-deploy!53
parents fd6f97cc 8dd0126f
Loading
Loading
Loading
Loading

.env

0 → 100644
+2 −0
Original line number Diff line number Diff line
DOCKER_COMPOSE_VERSION=1.24.0
OPENSSH_CLIENT_VERSION=7.7_p1-r4

.gitignore

deleted100644 → 0
+0 −0

Empty file deleted.

+6 −1
Original line number Diff line number Diff line
@@ -4,5 +4,10 @@ include:
    file: '/packaging.yml'

stages:
  - pre-package
  - package
  - test-package
  - post-package

.docker-build:
  variables:
    COMPOSE_FILE_NAME: docker-compose.yml
+24 −22
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ You can use it to deploy your own services, supporting **docker-compose** and **

For REDMIC, we use this image into CI/CD configuration. Deploy jobs are defined into our [GitLab CI configuration](https://gitlab.com/redmic-project/gitlab-ci-templates), but you can run it directly using `docker run`:

```
$ docker run --rm --name docker-deploy \
```sh
docker run --rm --name docker-deploy \
 -e SSH_REMOTE=ssh-user@host -e DEPLOY_KEY="<your-private-key>" \
 -e STACK=your-stack-name \
 -v $(pwd)/docker-compose.yml:/docker-compose.yml \
@@ -31,7 +31,7 @@ $ docker run --rm --name docker-deploy \
 <action> <arg1> <arg2> ...
```

As you can see, configuration is possible through environment variables and by script (<action>) parameters.
As you can see, configuration is possible through environment variables and by script (`<action>`) parameters.

Using environment variables, you can configure:

@@ -45,7 +45,7 @@ Using script parameters you can set:

## Configuration

### Docker deploy
### This service

You may define these environment variables (**bold** are mandatory):

@@ -53,7 +53,6 @@ You may define these environment variables (**bold** are mandatory):
* **SSH_REMOTE**: SSH user and hostname (DNS or IP) of remote host where you are going to deploy.
* **STACK**: Name of Docker stack (*Swarm* mode) or project (*docker-compose* mode) used to wrap deployed services.


* *COMPOSE_FILE*: Name of service definition file. Multiple files are supported, separated by colon (`:`). Default `docker-compose.yml`.
* *DEFAULT_DEPLOY_FILES*: Files needed for deployment. Used only if `DEPLOY_DIR_NAME` directory does not exist. Default `docker-compose*.yml .env`.
* *DEPLOY_DIR_NAME*: Name of directory containing files needed for deployment. If directory exists, `DEFAULT_DEPLOY_FILES` is ignored and all content is copied to remote host. Default `deploy`.
@@ -82,9 +81,12 @@ You may define these environment variables (**bold** are mandatory):
When using *deploy* action, you can configure your own services through variables:

* Define any variable whose name is prefixed by `ENV_PREFIX` prefix:

 1. Set variable `docker run ... -e DD_ANY_NAME=value ... deploy`.
 2. `ANY_NAME` will be available into service containers with `value` value.

* Pass any variable as deploy script parameter (without `ENV_PREFIX` prefix):

 1. Set parameter to deploy script: `docker run ... deploy ANY_NAME=value`.
 2. `ANY_NAME` will be available into service containers with `value` value.

@@ -92,7 +94,7 @@ When using *deploy* action, you can configure your own services through variable

### Deploy

```
```sh
$ ls -a deploy
.  ..  docker-compose.yml  .env

docker-compose.yml

0 → 100644
+11 −0
Original line number Diff line number Diff line
version: '3.5'

services:
  docker-deploy:
    image: ${IMAGE_NAME:-registry.gitlab.com/redmic-project/docker/docker-deploy}:${IMAGE_TAG:-latest}
    build:
      context: .
      dockerfile: ${DOCKERFILE:-Dockerfile}
      args:
        DOCKER_COMPOSE_VERSION:
        OPENSSH_CLIENT_VERSION: