Commit 6afae5ac authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request redmic-project/storage/nfs-server!1
parents 81ce2128 df966fc3
Loading
Loading
Loading
Loading
+69 −1
Original line number Diff line number Diff line
include:
  - project: 'pedroetb-projects/gitlab-ci-templates'
  - project: 'redmic-project/gitlab-ci-templates'
    ref: master
    file: '/deployment.yml'

@@ -8,5 +8,73 @@ stages:

.deploy:
  variables:
    STACK: storage
    FORCE_DOCKER_COMPOSE: 1
    SERVICES_TO_CHECK: ${CI_PROJECT_NAME}

.deploy-nfs-startup:
  variables: &deploy-nfs-startup-variables
    SERVICES_TO_CHECK: nfs-startup

.deploy-nfs-startup-development:
  extends: .deploy-development
  variables:
    COMPOSE_FILE: docker-compose.nfs-startup.tmpl.yml:docker-compose.nfs-startup.dev.yml
    <<: *deploy-nfs-startup-variables
  environment:
    name: dev/nfs-startup

.deploy-nfs-startup-production:
  extends: .deploy-production
  variables:
    COMPOSE_FILE: docker-compose.nfs-startup.tmpl.yml:docker-compose.nfs-startup.prod.yml
    <<: *deploy-nfs-startup-variables
  environment:
    name: pro/nfs-startup

.deploy-nfs-startup-support-branch: &deploy-nfs-startup-support-branch
  rules:
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule" ||
          $CI_COMMIT_BRANCH == "master"
      when: never
    - if: $CI_COMMIT_BRANCH
      when: manual
      allow_failure: true

deploy-nfs-startup-support-branch-development:
  extends: .deploy-nfs-startup-development
  <<: *deploy-nfs-startup-support-branch

.deploy-nfs-startup-stable-branch: &deploy-nfs-startup-stable-branch
  rules:
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule"
      when: never
    - if: $CI_COMMIT_BRANCH == "master"
      when: manual
      allow_failure: true

deploy-nfs-startup-stable-branch-development:
  extends: .deploy-nfs-startup-development
  <<: *deploy-nfs-startup-stable-branch

deploy-nfs-startup-stable-branch-production:
  extends: .deploy-nfs-startup-production
  <<: *deploy-nfs-startup-stable-branch

.deploy-nfs-startup-tag: &deploy-nfs-startup-tag
  rules:
    - if: $CI_COMMIT_TAG
      when: manual
      allow_failure: true

deploy-nfs-startup-tag-development:
  extends: .deploy-nfs-startup-development
  <<: *deploy-nfs-startup-tag

deploy-nfs-startup-tag-production:
  extends: .deploy-nfs-startup-production
  <<: *deploy-nfs-startup-tag
+13 −3
Original line number Diff line number Diff line
# nfs-server

Deployment of NFS server, to share contents (Docker Swarm volumes) between different hosts

## AppArmor

If your Docker host has [AppArmor](https://wiki.ubuntu.com/AppArmor) activated, you'll need to perform additional steps to allow the container to start an NFS server.

1. Ensure you have the `apparmor-utils` installed package installed on the Docker host. e.g. for Debian or Ubuntu:
1. Ensure you have the `apparmor-utils` and `lxc` packages installed on the Docker host. e.g. for Debian or Ubuntu:

       $ sudo apt-get install apparmor-utils
       sudo apt-get install apparmor-utils lxc

1. Create a file on the Docker host with the following contents:

@@ -19,4 +21,12 @@ If your Docker host has [AppArmor](https://wiki.ubuntu.com/AppArmor) activated,

1. Load this profile into the kernel with [`apparmor_parser`](http://manpages.ubuntu.com/manpages/xenial/man8/apparmor_parser.8.html):

       $ sudo apparmor_parser -r -W /path/to/file/from/previous/step
       sudo apparmor_parser -r -W /path/to/file/from/previous/step

1. If profile does not survive reboot, place it at `/etc/apparmor.d/`.

## NFS startup

You can set `NFS_STARTUP_DIRS` variable in order to create directories for the first time.

It is a list of `<directoryName>:<uid>:<gid>` separated by spaces, where `uid` and `gid` are optional.
+1 −1
Original line number Diff line number Diff line
@@ -2,5 +2,5 @@ NFS_VERSION=4.2
NFS_PORT=2049

NFS_ROOT_PATH=/nfs
NFS_ROOT_ADDR=10.0.0.0/8
NFS_ROOT_OPTS=rw,fsid=0,crossmnt,insecure,no_subtree_check,no_root_squash,async
DATA_VOL_NAME=nfs-data-vol
+1 −0
Original line number Diff line number Diff line
version: '2.4'
+1 −0
Original line number Diff line number Diff line
version: '2.4'
Loading