Search
K

Self Hosted

More about deploying Adapptio on your own infrastructure.
First you need to obtain token allows you to access Adapptio repository. For this, please, contact us.

Building image with GitLab CI/CD pipeline

Create new repositry

Once you have created a new repository, you also need to add several variables to your pipeline. Go to the CI/CD Gitlab settings (Settings -> CI/CD -> Variables) and add:
  1. 1.
    ARTIFACTS_LOGIN = <your-app-id>
  2. 2.
    ARTIFACTS_TOKEN = <obtained-token>

Dockerfile

Add to your repository this dockerfile.
prod.Dockerfile
1
ARG BASE_TAG
2
3
FROM ${BASE_IMAGE}:${BASE_TAG} as runtime
4
5
ARG BLUEPRINTS_DIR
6
7
# add blueprints
8
RUN rm -rf ./repo
9
ADD ${BLUEPRINTS_DIR} ./repo
10

CI/CD pipeline

And finaly add the CI/CD files and fill all the variables in the .param.yaml and .gitlab-ci.yaml file (section between lines 16 and 24).
.params.yaml
1
variables:
2
# Change this to update Adapptio runtime image
3
# Example "v9597de1b-master"
4
BASE_TAG: "<adapptio-image-version>"
5
# Change this to update application version
6
# Example: "v3"
7
BLUEPRINT_TAG: "<application-version>"
.gitlab-ci.yml
1
include: ".params.yaml"
2
3
services:
4
- docker:20.10.2-dind
5
6
stages:
7
- download-blueprints
8
- build-image
9
10
variables:
11
IMAGE_NAME: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
12
IMAGE_TAG: v${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_REF_SLUG}
13
BASE_IMAGE: "artifacts.adapptio.app:5000/adapptio/hae/app"
14
REPO_BASE_URL: "https://artifacts.adapptio.app:5001/artifacts"
15
16
# ---
17
# SETUP THIS VARIABLES
18
# Set UUID of your organization
19
# Example: "b9fbdcb2-fe44-45a6-836e-585715b3457a"
20
REPO_ORG_ID: "<your-org-id>"
21
# Set UUID of your application
22
# Example: "83110cc7-ea98-4a8f-a2ef-68f9d6fe1b27"
23
REPO_APP_ID: "<your-app-id>"
24
# ---
25
26
download-blueprints:
27
stage: download-blueprints
28
image:
29
name: ubuntu:latest
30
script:
31
- apt-get update && apt-get -y install wget
32
- |
33
wget \
34
--user="${ARTIFACTS_LOGIN}" \
35
--password="${ARTIFACTS_TOKEN}" \
36
-O ./blueprints.tar.gz \
37
${REPO_BASE_URL}/${REPO_ORG_ID}/${REPO_APP_ID}/${BLUEPRINT_TAG}.tar.gz
38
- tar -xf ./blueprints.tar.gz
39
artifacts:
40
paths:
41
- ./${REPO_APP_ID}
42
expire_in: 1 hour
43
44
build-image:
45
stage: build-image
46
image:
47
name: gcr.io/kaniko-project/executor:v1.9.0-debug
48
entrypoint: [""]
49
before_script:
50
- echo "Building ${IMAGE_NAME}:${IMAGE_TAG}"
51
- echo -n ${IMAGE_TAG} > version
52
- mkdir -p /kaniko/.docker
53
- |
54
echo "{ \"auths\": { \"$CI_REGISTRY\": { \"username\": \"${CI_REGISTRY_USER}\", \"password\": \"${CI_REGISTRY_PASSWORD}\" }, \"artifacts.adapptio.app:5000\": { \"username\": \"${ARTIFACTS_LOGIN}\", \"password\": \"${ARTIFACTS_TOKEN}\" }} }" > /kaniko/.docker/config.json
55
script:
56
- |
57
/kaniko/executor --context ${CI_PROJECT_DIR} \
58
--dockerfile ${CI_PROJECT_DIR}/prod.Dockerfile \
59
--destination ${IMAGE_NAME}:${IMAGE_TAG} \
60
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
61
--build-arg BASE_TAG="${BASE_TAG}" \
62
--build-arg BLUEPRINTS_DIR="./${REPO_APP_ID}"

Testing deployment using Docker compose

Create docker compose file in a workspace on your computer.
docker-compose.yaml
1
services:
2
adapptio:
3
image: "registry.gitlab.com/<your-gitlab-project>:<app-image-version>"
4
ports:
5
- "8080:8080"
6
environment:
7
- NODE_ENV=production
8
- APP_MANIFEST_PATH=/app/hae-bld-app/repo
9
- APP_ID=<your-application-id>
10
- APP_ENV_ID=<your-application-environment-id>
11
- APP_NAME=<application-name>
12
- APP_URL=localhost:8080
13
- APP_URL_PROTOCOL=<http|https>
14
- SESSION_SECRET=<session-secret>
15
- ...<YOUR_OWN_ENV_VARS>
Run docker and type:
cd <your-workspace-folder>
docker-compose up
The application should be available at URL:
https://localhost:8080