Okit is a free tool in continuous development for creating OCI diagrams. In this post we are installing the toll to create a diagram of an existing OCI environment.
Installing okit
The first step is to configure your OCI environment the same way you configure to run OCI CLI. Instructions here in the section OCI config file in there.
Then choose a directory in which okit will map to the docker image file system and run the following:
docker run -d --rm -p 80:80 --volume <homedir>/okit/user/templates:/okit/templates --volume <homedir>/.oci:/root/.oci --volume <homedir>/.ssh:/root/.ssh --name okit okit
For instance:
docker run -d --rm -p 80:80 --volume /Users/javiermugueta/okit/user/templates:/okit/templates --volume /Users/javiermugueta/.oci:/root/.oci --volume /Users/javiermugueta/.ssh:/root/.ssh --name okit okit
Now open your browser (it doesn’t work for me in Safari) in http://localhost/okit/designer
The okit user interface opens up. Now you can try it. Let’s build a diagram by introspecting an existing compartment. Go to uper left hamburger menu and select [Query]

Select a region and a compartement and click [Query] button.

After a while the diagram shows in the drawing pane…


The tool has interesting features such as calculate the cost, download the bill of materials, generate Terraform, Ansible or OCI Resource Manager code, etc.

Troubleshooting
If okit is not showing properly information of your tenancy, such as the list of compartments when you run the query option, it is because the docker image is not reading properly the values of the oci config. In my particular case it was produced because my ~/.oci/config file had full path entries, instead of relative paths, which are needed in order the docker image volume mapping works. Shall it occurs, run a shel in the docker image running and take a look how the .oci/config file is seen from the container point of view.

javiermugueta$ docker exec -it okit bash bash-4.2# bash-4.2# cat /root/.oci/config [DEFAULT] user = ocid1.user.oc1..aaaaaa...a fingerprint = 9...7 key_file = ~/.oci/oci_api_key.pem tenancy = ocid1.tenancy.oc1..aa...a region = eu-frankfurt-1
Tat’s all folks, hope it helps! š