-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcommands.txt
51 lines (44 loc) · 1.59 KB
/
commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
###################
# Lab 8 Solution #
###################
# Inventory DB
oc new-app postgresql-persistent \
--param=DATABASE_SERVICE_NAME=inventory-postgresql \
--param=POSTGRESQL_DATABASE=inventory \
--param=POSTGRESQL_USER=inventory \
--param=POSTGRESQL_PASSWORD=inventory \
--labels=app=inventory
# Catalog DB
oc new-app postgresql-persistent \
--param=DATABASE_SERVICE_NAME=catalog-postgresql \
--param=POSTGRESQL_DATABASE=catalog \
--param=POSTGRESQL_USER=catalog \
--param=POSTGRESQL_PASSWORD=catalog \
--labels=app=catalog
# Inventory ConfigMap
cat <<EOF > ./project-stages.yml
project:
stage: prod
swarm:
datasources:
datasources:
data-sources:
InventoryDS:
driver-name: postgresql
connection-url: jdbc:postgresql://inventory-postgresql:5432/inventory
user-name: inventory
password: inventory
EOF
oc create configmap inventory --from-file=project-stages.yml=./project-stages.yml
oc volume dc/inventory --add --configmap-name=inventory --mount-path=/app/config
oc set env dc/inventory JAVA_OPTIONS="-Dswarm.project.stage=prod -Dswarm.project.stage.file=file:///app/config/project-stages.yml"
# Catalog Config Map
cat <<EOF > ./application.properties
spring.datasource.url=jdbc:postgresql://catalog-postgresql:5432/catalog
spring.datasource.username=catalog
spring.datasource.password=catalog
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=create
EOF
oc create configmap catalog --from-file=application.properties=./application.properties
oc delete pod -l app=catalog