Create a Kubernetes cluster through the OCI web console.
Follow Creating a Kubernetes Cluster.
Configure kubectl on Cloud Shell. Follow steps on Quick start on your Kubernetes Cluster.
Create an Autonomous database. Write down db name, and password.
Clone this repository in your local machine:
git clone https://github.com/vmleon/oci-multiplayer.git
Change directory to the oci-multiplayer
:
cd oci-multiplayer
To complete the environment setup you need an Auth Token from OCI.
Export the variable OCI_OCIR_TOKEN
for best practices. Otherwise the script will ask for the token.
Keep the double quotes to escape the token
export OCI_OCIR_TOKEN="[your_auth_token]"
You can also export OCI_OCIR_USER
to the user (email) to login to the OCI container registry.
export OCI_OCIR_USER=[your_email]
Score backend use Oracle Autonomous Database, to find it we need compartment, name and the password you set at creation time.
export ADB_COMPARTMENT_NAME=[comapartmentName]
export ADB_NAME=[Autonomous DB name]
export ADB_PASSWORD="[Autonomous DB password]"
Set environment:
npx zx scripts/setenv.mjs
This script will:
- check dependencies
- create self-signed certs, if needed
- login to container registry
- print components versions
Release all components:
npx zx scripts/release.mjs -a
Run the setup for the deployment:
npx zx scripts/deploy.mjs
When the output says:
Ready to deploy. Run: kubectl apply -k deploy/k8s/overlays/prod
You can run the kubectl apply:
kubectl apply -k deploy/k8s/overlays/prod
Get the Public IP of the load balancer
kubectl -n ingress-nginx get svc
Change the code, and bump the version of the component:
Web:
npx zx scripts/bump.mjs web
Web Socket Server:
npx zx scripts/bump.mjs server
Score Backend:
npx zx scripts/bump.mjs score
Run release script for the component to push the new image.
npx zx scripts/release.mjs [component]
Update the deployment with the new versions:
npx zx scripts/deploy.mjs
Redeploy with:
kubectl apply -k deploy/k8s/overlays/prod
Destroy all the infrastructure:
kubectl delete -k deploy/k8s/overlays/prod
TODO delete container images on OCI registry
## Development Locally
To run in dev mode:
-TODO: Create steps about config in the server (.env)
Server on its own terminal:
export REDIS_PASSWORD=fk3ampeHq
zx scripts/start_redis.mjs
zx scripts/start_coherence.mjs
cd server
npm install
npm start
Client on its own terminal:
cd web
npm run dev
Score on its own terminal:
cd score
./gradlew bootRun
To clean up after
zx scripts/stop_redis.mjs
zx scripts/stop_coherence.mjs