Skip to content

jlowe000/oci-arcade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oci-arcade

This was created to demonstrate a few things about Oracle Cloud Infrastructure in a "fun" way. There are different elements of the OCI that have been exercised that will be discussed here.

This borrows a couple of open-source javascript games to extends and play with.

This is a rought set of notes to get this up and running.

Branches

There's a number of branches that exist for the purposes of terraform using https://github.com/jlowe000/oci-arcade-tf.

  • master - a version of the kafka / conherence implementation on arm64. (using 1 x A1.Flex arm64 VM)

Pre-Requisites

  • Need an OCI Tenancy and this is built with a Always-Free Tier account in mind.
  • Need an administrator access to the account (keeping it simple).

1. Get Stuff Prepared

  • Create a compartment (and note the OCID)
  • Note your tenancy namespace and OCID
  • Note your user OCID
  • Know which region you are deploying into
  • Know which compute shape and source-image to deploy compute
  • Know whether you want to run a free-tier instance of the database
  • Create a SSH Key (ie using puttygen or ssh-keygen)
  • Define an admin password for ADW
  • Know where you want to kafka events to be sent to (can be retargeted to a different kafka cluster)

Here are some references to help

2. Start Provisioning ...

(This is different for the different variations above)

  1. Create a VCN with a public subnet
  2. Create an ADW instance
  3. Create 1 A1.Flex compute instance in the public subnet (for the purposes of this README - one will be referred to as arcade-web)
  4. Create an object storage bucket that is public
  5. On arcade-web:
    1. Install git, docker, docker-compose, pip, Oracle Cloud CLI, Oracle Instant Client
    2. Update the firewall with 8080/tcp, 8081/tcp
    3. Create an overlay network called arcade_network
    4. Create an oracle user
    5. More to come ...
  6. On arcade-web (as user):
    1. Build / Run kafka cluster
    2. Create a keys for the OCI API Signing Keys.
    3. Configure OCI CLI with a profile to point to your tenancy
    4. Download the ADW wallet and configure.
    5. Create a database user and run the following scripts.
      • infra/db/init.sql
      • apis/score/db/init.sql
      • apis/events/db/init.sql
      • apis/users/db/init.sql
      • apis/users/db/init-crm-app.sql
      • apis/users/db/init-crm-config.sql
    6. Create a dockerfile from containers/web/api-score.Dockerfile.template
    7. Build / Run kafka events
    8. Build and Run api-score NodeJS server
    9. Upload games to object storage (if user api-key is enabled)
    10. More to come ...

(I'm reverse engineering these steps from the Terraform project).

  • Note:
    • In an Always-Free Tier, you make get issues when you "Apply" because (these are the common ones I found):
      • There can only be 2 x VCN allowed in the tenancy.
      • There can only be 2 x E2.1.Micro VM instances, 4 x A1.Flex VM instances and 2 x Autonomous Database instances.
    • Need to "accept" exception in browser for the API calls (https://:8081/event) - Without this step, API calls from game will fail with CERT exception
    • If you are wanting to "Destroy" the stack, you need to delete the folders in the oci-arcade bucket before running the Terraform destroy activity. Otherwise, the bucket will fail to be destroyed. You can delete the folders which will delete the underlying objects.