Skip to content

Commit 36eecb7

Browse files
Pogrebnyak, SergeiPogrebnyak, Sergei
Pogrebnyak, Sergei
authored and
Pogrebnyak, Sergei
committed
Hello world container
1 parent f446ab7 commit 36eecb7

File tree

13 files changed

+227
-189
lines changed

13 files changed

+227
-189
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Please see [Contributing section on wiki](https://github.com/SoftwareAG/sagdevops-templates/wiki/Contributing)

containers/docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,23 @@ services:
4141
# - ./scripts/provision.sh:/opt/sagtools/provision.sh
4242
# - ./environments/:/src/environments/
4343

44+
hello-world:
45+
image: ${REG:-softwareag}/hello-world:${TAG:-10.3}
46+
build:
47+
context: hello-world/
48+
args:
49+
- BUILDER_IMAGE=${REG:-softwareag}/commandcentral-builder:${TAG:-10.3}
50+
- BASE_IMAGE=${REG:-softwareag}/java:${TAG:-10.3}
51+
- __hello_world=Container # container specific build ARG
52+
ports:
53+
- 8092 # container specific ports
54+
- 8093
55+
environment:
56+
- CC_AUTO_REGISTER=0 # No auto register
57+
- HELLO_NAME=CONTAINER_INSTANCE # container specific ENV var
58+
# volumes:
59+
# - ./entrypoint.sh:/opt/softwareag/entrypoint.sh # for dev only to avoid image rebuild
60+
4461
universal-messaging:
4562
image: ${REG:-softwareag}/universal-messaging:${TAG:-10.3}
4663
build:

containers/generic/Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

templates/sag-spm-config/Dockerfile renamed to containers/hello-world/Dockerfile

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright © 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
2+
# Copyright 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
33
#
44
# SPDX-License-Identifier: Apache-2.0
55
#
@@ -16,27 +16,33 @@
1616
# limitations under the License.
1717
#
1818
###############################################################################
19-
ARG TAG=10.3
20-
ARG BUILDER_IMAGE=daerepository03.eur.ad.sag:4443/ccdevops/commandcentral-builder:$TAG
21-
ARG BASE_IMAGE=daerepository03.eur.ad.sag:4443/ibit/java:jdk-8-centos
19+
20+
ARG BUILDER_IMAGE
21+
ARG BASE_IMAGE
2222

2323
FROM $BUILDER_IMAGE as builder
2424

25-
# build arg for hello.name template parameter
25+
# template alias to apply
26+
ARG TEMPLATE=sag-spm-config
27+
28+
# build-time template parameter: hello.world
2629
ARG __hello_world=default
27-
# runtime container init parameter
30+
31+
# run-time container init parameter
2832
ENV HELLO_NAME=default
2933

30-
# Apply template.yaml with env.properties and run smoke tests
31-
RUN $CC_HOME/provision.sh && ./test.sh && $CC_HOME/cleanup.sh
34+
# Apply template.yaml, run smoke tests, cleanup
35+
RUN $CC_HOME/provision.sh $TEMPLATE && \
36+
$CC_HOME/profiles/CCE/data/templates/composite/$TEMPLATE/test.sh && \
37+
$CC_HOME/cleanup.sh
3238

33-
# Target image
39+
# target image
3440
FROM $BASE_IMAGE
3541

3642
# expose any ports from runtimes defined in the template.yaml
3743
EXPOSE 8092 8093
3844

39-
COPY --from=builder $SAG_HOME $SAG_HOME
45+
COPY --from=builder --chown=1724:1724 $SAG_HOME $SAG_HOME
4046

4147
# entrypoint scripts
4248
ADD entrypoint.sh $SAG_HOME

containers/hello-world/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!-- Copyright 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
2+
3+
SPDX-License-Identifier: Apache-2.0
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
16+
limitations under the License.
17+
18+
-->
19+
20+
# Building Hello World container image
21+
22+
Use this template to build a simple hello-world container image.
23+
24+
## Requirements and limitations
25+
26+
### Supported Software AG releases
27+
28+
* Platform Manager 10.1 or higher
29+
* Command Central 10.3 or higher
30+
31+
### Supported platforms
32+
33+
* Docker 18.06-ce or higher
34+
35+
### Supported use cases
36+
37+
* Building a Docker image with configured Platform Manager
38+
39+
## Building Docker image
40+
41+
### Building using docker-compose
42+
43+
Build the container image:
44+
45+
```bash
46+
cd sagdevops-template/containers
47+
docker-compose build hello-world
48+
```
49+
50+
Run the container:
51+
52+
```bash
53+
docker-compose up -d hello-world
54+
docker-compose port hello-world 8092
55+
```
56+
57+
Open Platform Manager in the browser using the address printed above:
58+
59+
```bash
60+
open http://localhost:PORT/spm
61+
```
62+
63+
Login as `Administrator/manage`
64+
65+
Examine the configuration.
66+
67+
### Parameterizing configuration
68+
69+
You can provide the configuration values by:
70+
71+
* Hardcoding them in the template.
72+
* Defining them as parameters in an [env.properties](env.properties) file.
73+
* Defining them as build arguments in [Dockerfile](Dockerfile) and [docker-compose.yml](../docker-compose.xml) file. See `__hello_world`.
74+
* Defining them in the template as ENV variables resolved at container startup. See `%HELLO_NAME%`

templates/sag-spm-config/entrypoint.sh renamed to containers/hello-world/entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh -e
22
#*******************************************************************************
3-
# Copyright © 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
3+
# Copyright 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
44
#
55
# SPDX-License-Identifier: Apache-2.0
66
#
@@ -17,5 +17,6 @@
1717
# limitations under the License.
1818
#
1919
#*******************************************************************************
20+
2021
echo "Hello $HELLO_NAME !"
2122
$SAG_HOME/profiles/SPM/bin/console.sh
Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
2+
# Copyright 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
33
#
44
# SPDX-License-Identifier: Apache-2.0
55
#
@@ -16,23 +16,6 @@
1616
# limitations under the License.
1717
#
1818
###############################################################################
19-
version: "3.2"
2019

21-
services:
22-
spm:
23-
image: daerepository03.eur.ad.sag:4443/ccdevops/commandcentral-node:$TAG # target image
24-
build:
25-
context: .
26-
dockerfile: Dockerfile # instructions to build image
27-
args:
28-
- TAG
29-
- __hello_world=Container # container specific build ARG
30-
ports:
31-
- 8092 # container specific ports
32-
- 8093
33-
environment:
34-
- CC_AUTO_REGISTER=0 # No auto register as we don't have a server
35-
- HELLO_NAME=CONTAINER_INSTANCE # container specific ENV var
36-
# volumes:
37-
# - ./entrypoint.sh:/opt/softwareag/entrypoint.sh # for dev only to avoid image rebuild
38-
# - ./test.sh:/test.sh # for dev only to avoid image rebuild
20+
# parameters to bake into the Docker image build
21+
hello.world=CommandCentral
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<!-- Copyright 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
2+
3+
SPDX-License-Identifier: Apache-2.0
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
16+
limitations under the License.
17+
18+
-->
19+
20+
# Building Universal Messaging container image
21+
22+
Use this template to build a Universal Messaging container image.
23+
24+
## Requirements and limitations
25+
26+
### Supported Software AG releases
27+
28+
* Universal Messaging 10.3 or higher
29+
* Command Central 10.3 or higher
30+
31+
### Supported platforms
32+
33+
* Docker 18.06-ce or higher
34+
35+
## Building Docker image
36+
37+
### Building using docker-compose
38+
39+
Build the container image:
40+
41+
```bash
42+
cd sagdevops-template/containers
43+
docker-compose build universal-messaging
44+
```
45+
46+
Run the container:
47+
48+
```bash
49+
docker-compose up -d hello-world
50+
docker-compose port hello-world 8092
51+
```
52+
53+
Open Platform Manager in the browser using the address printed above:
54+
55+
```bash
56+
open http://localhost:PORT/spm
57+
```
58+
59+
Login as `Administrator/manage`
60+
61+
Examine the configuration.
62+
63+
## Running containers
64+
65+
### Using Docker
66+
67+
Use the following content for the `docker-compose.yml` file, then run `docker-compose up`.
68+
69+
```yaml
70+
version: '3'
71+
services:
72+
um:
73+
image: universal-messaging
74+
ports:
75+
- '9000:9000'
76+
```
77+
78+
Or you can use `docker run` directly:
79+
80+
```shell
81+
docker run \
82+
--name um \
83+
-p 9000:9000 \
84+
-d \
85+
universal-messaging
86+
```
87+
88+
Universal Messaing Realm Server is accessible on port 9000.
89+
90+
### Using Kubernetes
91+
92+
Copy the following content to `pod.yaml` file, and run `kubectl create -f pod.yaml`.
93+
94+
```yaml
95+
apiVersion: v1
96+
kind: Pod
97+
metadata:
98+
name: um
99+
labels:
100+
name: um
101+
spec:
102+
containers:
103+
- image: universal-messaging
104+
name: um
105+
```

templates/sag-spm-config/README.md

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
limitations under the License.
1717
1818
-->
19+
1920
# Platform Manager Configurations
2021

2122
Use this template to configure Platform Manager.
@@ -37,43 +38,13 @@ All supported Windows and UNIX platforms.
3738
* Tanuki Java Service wrapper
3839
* Java System properties
3940
* Monitoring interval
40-
* Building a Docker image with configured Platform Manager
4141

4242
## Running as a composite template
4343

44-
To apply custom configurations to two Platform Managers, registered as node1 and node2:
44+
Apply custom configurations to Platform Managers, registered as `node1` and `node2`:
4545

4646
```bash
4747
sagcc exec templates composite apply sag-spm-config nodes=node1,node2 \
48-
hello.world=spm \
49-
--sync-job --wait 360
48+
hello.world=spm \
49+
--sync-job --wait 360
5050
```
51-
52-
## Building Docker image
53-
54-
You can build a Docker image with a custom Platform Manager configuration, where you can provide the configuration values by:
55-
56-
* Hardcoding them in the template.
57-
* Defining them as parameters in an [env.properties](env.properties) file.
58-
* Defining them as build arguments in Dockerfile and docker-compose.yml file. See `__hello_world`.
59-
* Defineing them in the template as ENV variables resolved at container startup. See `%HELLO_NAME%`.
60-
61-
To build a Docker image with custom Platform Manager configuration:
62-
63-
```bash
64-
docker-compose build
65-
```
66-
67-
To run the container:
68-
69-
```bash
70-
docker-compose up -d node
71-
```
72-
73-
To open Platform Manager in the browser:
74-
75-
```bash
76-
open http://`docker-compose port node 8092`/spm
77-
```
78-
79-
Login as `Administrator/manage`.

0 commit comments

Comments
 (0)