Technical manual
...
iR Engine deployment
iR Engine on Minikube
18 min
install kubectl, helm, docker, and virtualbox if kubectl https //kubernetes io/docs/tasks/tools/ , helm https //helm sh/docs/intro/install/ , docker https //docs docker com/get docker/ and/or virtualbox https //www virtualbox org/wiki/downloads aren't already installed on your machine, install them you may also need to install docker compose https //docs docker com/compose/install/ download and install minikube instructions can be found here https //minikube sigs k8s io/docs/start/ while you can follow the demo instructions there about starting minikube, deploying some demo deployments, etc to get a feel for it, before deploying ir engine you should delete your minikube cluster, since we have some specific starting requirements clone ir engine repo to your local machine to build the ir engine docker image locally, and to have a pre tested way to run various local services, you'll need to get the ir engine repo on your machine this is most easily done by running git clone https //github com/ir engine/ir engine git start minio & mariadb server locally via docker for simplicity, we recommend running minio & mariadb server on your local machine outside of microk8s if you run docker compose up from the top level /scripts directory in the ir engine repo, it will start up minio & multiple mariadb docker containers (as well as a redis server, which is not needed) for mariadb containers, one is intended for local development, runs on port 3306; another, intended for automated testing purposes, runs on port 3305; and the last one, intended for minikube/microk8s testing, runs on port 3304 once the docker container is stopped, you can start it again by running npm run dev docker alternatively, if you want to just run minio & mariadb on its own without docker, that's fine too you'll just have to configure the helm config file to have the appropriate s3 & sql server configuration, and possibly change the script /scripts/build minikube sh create minikube cluster run the following command minikube start disk size 40000m cpus 4 memory 10124m addons ingress driver virtualbox this says to start minikube with 40gb of disk space, 4 cpus, 10gb of memory, using virtualbox as its driver, and starting up an nginx ingress service the disk space, cpus, and memory allocation are configurable these are what we recommend for optimal running (though the disk space might be a bit more than necessary) when minikube is running, it will reserve those resources for itself regardless of whether the services in minikube are using that much the 10gb of memory might be the spec with the least wiggle room later instructions on building the docker image will have it be built in the minikube context this uses the ram reserved for minikube, and the client build process normally uses about 8gb of ram at its peak minikube may freeze if it gets maxed out on ram, and the docker build process might freeze indefinitely starting ingress after minikube has started if you forget to use addons ingress when starting minikube, you can start nginx later by running minikube addons enable ingress get minikube ip address and edit system hostfile to point to run this command after minikube has started minikube ip this will get you the address that minikube is running on you'll need to edit your hostfile to point certain domains to minikube ip addresses on linux, this is done by running sudo gedit /etc/hosts add the following lines \<output of 'minikube ip'> local etherealengine org api local theinfinitereality io instanceserver local theinfinitereality io 00000 instanceserver local theinfinitereality io 00001 instanceserver local theinfinitereality io 00002 instanceserver local theinfinitereality io 00003 instanceserver local theinfinitereality io 10 0 2 2 host minikube internal the first line says to point several local etherealengine org domains internally to the minikube cluster, where the nginx ingress server will redirect the traffic to the appropriate pod the second line is used to give minikube access to your local environment, particularly so that it can access the mariadb server make sure to save this file after you've edited it on linux, at least, you need root permissions to edit it add helm repos you'll need to add a few helm repos run the following helm repo add agones https //agones dev/chart/stable helm repo add redis https //charts bitnami com/bitnami helm repo add etherealengine https //helm etherealengine org this will add the helm charts for agones, redis, and ir engine, respectively install agones and redis deployments after adding those helm repos, you'll start installing deployments using helm repos make sure that kubectl is pointed at minikube by running kubectl config current context , which should say 'minikube' you can also run kubectl config get contexts to get all contexts that kubectl has been configured to run; the current one will have a ' ' under the left most 'current' column once kubectl is pointed to minikube, from the top of the ir engine repo, run helm install f \</path/to/agones default values yaml> agones agones/agones to install agones and helm install local redis redis/redis to install redis agones default values yaml https //github com/ir engine/ir engine ops/blob/master/configs/agones default values yaml can be found in ir engine ops https //github com/ir engine/ir engine ops/ repo you can run kubectl get pods a to list all of the pods running in minikube after a minute or so, all of these pods should be in the running state install elastic search and kibana using helm for server logs to install elasticsearch, add the elastic repository in helm helm repo add elastic https //helm elastic co now, use the curl command to download the values yaml file containing configuration information curl o https //raw\ githubusercontent com/elastic/helm charts/master/elasticsearch/examples/minikube/values yaml use the helm install command and the values yaml file to install the elasticsearch helm chart helm install elasticsearch elastic/elasticsearch f /values yaml the f option allows specifying the yaml file with the template if you wish to install elasticsearch in a specific namespace, add the n option followed by the name of the namespace helm install elasticsearch elastic/elasticsearch n \[namespace] f /values yaml now check if the cluster members are up kubectl get pods namespace=default l app=elasticsearch master w the other option is to use the helm test command to examine the cluster’s health helm test elasticsearch to install kibana on top of elasticsearch helm install kibana elastic/kibana check if all the pods are ready kubectl get pods after you set up port forwarding, access elasticsearch, and the kibana gui by typing https //localhost 5601 in your browser in order to connect logger with elasticsearch, update local minikube template values yaml env api extraenv elastic host for e g https //\<username> \<password>@\<host> \<port> local minikube template values yaml https //github com/ir engine/ir engine ops/blob/master/configs/local minikube template values yaml can be found in ir engine ops https //github com/ir engine/ir engine ops/ repo run build minikube sh when minikube is running, run the following command from the root of the ir engine repo /scripts/build minikube sh if you face issue related to "packages/projects/projects/" does not exist then run following commands in your terminal export mysql host=localhost npm run dev docker npm run dev reinit npx ts node swc scripts/install projects js export mysql host=host minikube internal this points docker in the current terminal to minikube's docker environment anything that docker builds will be locally accessible to minikube; if the first main command in the script were not run, docker would build to your machine's docker environment, and minikube would not have access to it the script also builds the full repo docker image using several build arguments vite, which builds the client files, uses some information from the mariadb database created for minikube deployments to fill in some variables, and needs database credentials the script will supply default values for all of the mysql variables if they are not provided to the script, as well as vite client host, vite server host, and vite instanceserver host the latter three will make your minikube deployment accessible on (local/api local/instanceserver local) etherealengine org ; if you want to run it on a different domain, then you'll have to set those three environment variables to what you want them to be (and also change the hostfile records you made pointing those subdomains to minikube's ip) this will build an image of the entire ir engine repo into a single docker file when deployed for different services, it will only run the parts needed for that service this may take up to 15 minutes, though later builds should take less time as things are cached update helm values file this will use a helm config file titled 'local values yaml' to configure the deployment there is a template https //github com/ir engine/ir engine ops/blob/master/configs/local minikube template values yaml for this file in ir engine ops https //github com/ir engine/ir engine ops/ repo if you are using local file server as explained couple of steps earlier then, update 'local values yaml' variable api fileserver hostuploadfolder with value e g '/hosthome/\<os user name>/\<engine folder>/packages/server/upload' the folder must be in home folder and make sure to use /hosthome/ instead of home in path its mandatory to point to /packages/server/upload folder of your engine folder deploy ir engine helm chart run the following command helm install f \</path/to/local values yaml> f \</path/to/db refresh true values yaml> local ir engine/ir engine db refresh true values yaml https //github com/ir engine/ir engine ops/blob/master/configs/db refresh true values yaml can be found in ir engine ops https //github com/ir engine/ir engine ops/ repo after a minute or so, running kubectl get pods should show one or more instanceservers, one or more api servers, and one client server in the running state setting force db refresh=true made the api servers (re)initialize the database since you don't want that to happen every time a new api pod starts, run helm upgrade reuse values f \</path/to/db refresh false values yaml> local ir engine/ir engine the api pods will restart and will now not attempt to reinit the database on boot db refresh false values yaml https //github com/ir engine/ir engine ops/blob/master/configs/db refresh false values yaml can be found in ir engine ops https //github com/ir engine/ir engine ops/ repo accept invalid certs since there are no valid certificates for this domain, you'll have to tell your browser to ignore the insecure connections when you try to load the application go to < https //local etherealengine org/> https //local etherealengine org/> , you should see a warning about an invalid certificate; accept this invalid cert to get to the home page next if it keeps displaying 'loading routes' progress for a long time, it is due to the fact that you have to allow certificates you'll have to open the dev tools for your browser and go to the 'console' tab you will see some errors in url address starting with 'wss' replace 'wss' with 'https' and open it in new tab accept the certificate and reload your ir engine tab you need to do this for following domains wss\ //api local theinfinitereality io > https //api local theinfinitereality io https //api local theinfinitereality io wss\ //instanceserver local theinfinitereality io > https //instanceserver local theinfinitereality io https //instanceserver local theinfinitereality iohttps //localhost 9000 https //localhost 9000 you can open developer tools in chrome by clicking the side menu with three dots, then more tools > developer tools (or use ctrl+shift+i)