https://github.com/h3nrique/postalcode-spawn-demo
Java demo project using Spawn to find postal codes at ViaCEP.
https://github.com/h3nrique/postalcode-spawn-demo
container java kubernetes openshift serverless spawn
Last synced: about 3 hours ago
JSON representation
Java demo project using Spawn to find postal codes at ViaCEP.
- Host: GitHub
- URL: https://github.com/h3nrique/postalcode-spawn-demo
- Owner: h3nrique
- Created: 2023-09-27T15:04:32.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-12T23:09:55.000Z (over 1 year ago)
- Last Synced: 2024-11-12T23:19:10.851Z (over 1 year ago)
- Topics: container, java, kubernetes, openshift, serverless, spawn
- Language: Java
- Homepage:
- Size: 111 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Postalcode Spawn Demo
Java demo project using [Spawn](https://github.com/eigr/spawn) to find postal codes at [ViaCEP](https://viacep.com.br).
## Test
Before running the Maven command, ensure that a container environment (Docker/Podman) is running.
```bash
mvn test
```
## Start local environment
```bash
docker compose up
```
## Test local environment
```bash
# Request PostalCode
curl -v -H 'Content-Type: application/json' -d '{ "postalCode": "03568000" }' 'http://localhost:8080/postalcode'
# Get PostalCode info
curl -v 'http://localhost:8080/postalcode/03568000'
```
## To deploy on Openshift with Openshift Pipeline (Tekton)
```bash
oc create ns spawn
oc process openshift//mysql-persistent -p MYSQL_USER=admin -p MYSQL_PASSWORD=admin -p MYSQL_ROOT_PASSWORD=mypassword -p MYSQL_DATABASE=eigr | oc create -n spawn -f -
oc create secret generic mysql-connection-secret -n eigr-functions --from-literal=database=eigr --from-literal=host='mysql.spawn.svc.cluster.local' --from-literal=port='3306' --from-literal=username='admin' --from-literal=password='admin' --from-literal=encryptionKey=$(openssl rand -base64 32)
tee actorsystem.yaml << END
apiVersion: spawn-eigr.io/v1
kind: ActorSystem
metadata:
name: spawn-demo
labels:
app: spawn-demo
spec:
# selector:
# app: spawn-demo
statestore:
type: MySql
credentialsSecretRef: mysql-connection-secret
pool:
size: "10"
END
oc create -f actorsystem.yaml -n spawn
oc create -f openshift-pipeline.yaml -n spawn
oc create role actorhost-pipeline --verb='*' --resource='actorhosts,actorsystems' -n spawn
oc create rolebinding actorhost-pipeline --role=actorhost-pipeline --serviceaccount=spawn:pipeline -n spawn
# If you want to expose actor service with route command
oc create route edge postalcode --service=postalcode-spawn-demo --port=8080
```