This repo contains the source code to build the vote
, worker
and results
images for deploying the the APL Example App
- based on the Example Voting App - using the provided quickstart Helm charts in the APL Catalog.
Use the Build feature in Otomi to build the images with Docker
mode for the result
,vote
and worker
components:
- Set the build name (ex.
voting-app-vote
) - Set the
Repo URL
tohttps://github.com/redkubes/example-voting-app.git
- Set the
path
to./vote/Dockerfile
- Repeat step 1,2 and 3 for the other 2 components
- use
./result/Dockerfile
and./worker/Dockerfile
paths respectively
- use
Use the postgresql
and the redis
charts in the APL Catalog
to create a Redis master-replica cluster and a PostgreSQL database.
- Postgresql:
- Name:
<postgesql app name>
(E.g.voting-app-psql
). - Click
Submit
(can use default values for this example)
- Name:
- Redis:
- Name:
<redis app name>
(E.g.voting-app-redis
). - For this demo, Redis authentication needs to be turned off by setting
in the chart
auth: enabled: false
Values
editor. - Click
Submit
and thenDeploy
- Name:
Use the k8s-deployment
chart to deploy the vote app. Use the following values:
- Name:
voting-app-vote
- Update Values:
containerPorts: - name: http containerPort: 80 protocol: TCP env: - name: REDIS_HOST value: <redis-cluster-name>-master # E.g. voting-app-redis-master
- Click
Submit
Use the k8s-deployment
chart to deploy the worker app. Use the following values:
- Name:
voting-app-worker
- Update Values:
containerPorts: - name: http containerPort: 80 protocol: TCP env: - name: DATABASE_USER valueFrom: secretKeyRef: name: <psql-cluster-name>-superuser # E.g. voting-app-psql-superuser key: username - name: DATABASE_PASSWORD valueFrom: secretKeyRef: name: <psql-cluster-name>-superuser # E.g. voting-app-psql-superuser key: password - name: REDIS_HOST value: <redis-cluster-name>-master # E.g. voting-app-redis-master - name: DATABASE_HOST value: <psql-cluster-name>-rw # E.g. voting-app-psql-rw
- Click
Submit
Use the k8s-deployment
chart to deploy the result app. Use the following values:
- Name:
voting-app-result
- Update Values:
containerPorts: - name: http containerPort: 80 protocol: TCP env: - name: DATABASE_USER valueFrom: secretKeyRef: name: <psql-cluster-name>-superuser # E.g. voting-app-psql-superuser key: username - name: DATABASE_PASSWORD valueFrom: secretKeyRef: name: <psql-cluster-name>-superuser # E.g. voting-app-psql-superuser key: password - name: DATABASE_HOST value: <psql-cluster-name>-rw # E.g. voting-app-psql-rw
- Click
Submit
and thenDeploy
Register the vote
and result
services in APL and configure them for external exposure.
- Register the
vote
service - Set exposure to
External
- Click
Submit
- Register the
result
service - Set exposure to
External
- Click
Submit
and thenDeploy
If Network policies
are enabled, then register all services and configure the network policies:
- Create a new Netpol and select the ingress rule type
- Add the selector label name
otomi.io/app
- Add the selector label value
<postgres-workload-name>
(E.g.voting-app-psql
) - Select AllowOnly
- Add the namespace
<team-name>
(E.g.team-demo
), the selector label nameotomi.io/app
and the selector label value<worker>
(E.g.voting-app-worker
) - Add the namespace
<team-name>
(E.g.team-demo
), the selector label nameotomi.io/app
and the selector label value<result>
(E.g.voting-app-result
) - Click
Submit
- Create a new network policy and select the ingress rule type
- Add the selector label name
otomi.io/app
- Add the selector label value
<redis-workload-name>
(E.g.voting-app-redis
) - Select AllowOnly
- Add the namespace
<team-name>
(E.g.team-demo
), the selector label nameotomi.io/app
and the selector label value<worker>
(E.g.voting-app-worker
) - Add the namespace
<team-name>
(E.g.team-demo
), the selector label nameotomi.io/app
and the selector label value<vote>
(E.g.voting-app-vote
) - Click
Submit
and thenDeploy