Working with Horizon

Hey everyone! 🙂

As I mentioned in my last post, I have been working with Solum’s dashboard and have been learning a lot about working with Horizon in this process. In my last post I described the basic dashboard structure for Horizon. In this post I’d like to share a few more details about working with Horizon as well as its dashboards.

I have been using a devstack setup with Solum also set up on it to test my work. In order to test the changes I make to the Solum dashboard, I make the relevant changes in the /opt/stack/solum-dashboard directory.

If you wish to create a custom dashboard from scratch and test it out on Horizon, Horizon provides a way of creating a dashboard directory with the structure required, which you can then customize. The steps that you can follow to create this directory structure are as follows:


mkdir openstack_dashboard/dashboards/mydashboard

./run_tests.sh -m startdash mydashboard --target openstack_dashboard/dashboards/mydashboard

./run_tests.sh -m startpanel mypanel --dashboard=openstack_dashboard.dashboards.mydashboard --target=openstack_dashboard/dashboards/mydashboard/mypanel

The above commands need to be run in the horizon directory itself i.e. the one where the run_tests.sh script resides. The above commands generate the mydashboard directory with all the necessary files related to the dashboard, and the mypanel directory inside it with all the necessary files related to the panel. You can replace mydashboard and mypanel in the above commands with the names for the dashboard and panel as you wish. Once these directory structures are in place, you can start customizing the directory and panel as you wish.

In order to test any changes you make in a dashboard or even in the Horizon code itself, the Horizon server needs to be restarted to reflect the changes made, for which just restarting the Apache server suffices, the command for which is:


sudo service apache2 restart

Another very important thing to learn is how to debug the code you have written. So when working with Horizon, the error logs for Horizon are available in the /var/log/apache2/ directory, along with Horizon access logs, keystone access logs etc. In order to debug any error that you encounter when testing changes in a dashboard, whether it is an internal server error, or an error being thrown when trying to submit a form, further details about why the error is being thrown i.e. the relevant logs can be found in the horizon_error.log file.

Stay tuned for more updates on working with dashboards in Horizon! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s