Astuce Ceph

Ceph dashboard without internet access

The point of this blogpost is to share a method to have ceph dashboard working without internet access.

By Julien Lavesque, Cloud Consultant at Objectif Libre.

 

Last week I had to upgrade a Ceph cluster from Jewel to Luminous for a customer. The cluster was deployed using ceph-ansible so I was able to use the infrastructure-playbooks/rolling_update.yml playbook.

This playbook is kind of magical, as it handles the update process for you flawlessly (including OSD restart delay and all). This is not the point of this blogpost, but if you consider updating your cluster it’s worth having a look at it.

 

The problem

The cluster is a bit specific: it’s installed on a segregated network with no internet access. It was not a problem during installation and update processes, as we have provisioned an offline mirror, but I had a little surprise enabling the ceph-mgr dashboard for monitoring.

The resulting page looked like this:

 

Investigation on the page source leads to the following code:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>

The dashboard retrieves some CSS et Javascript online on cloudflare, but when there is no internet access the dashboard is not working.

 

The solution

All the CSS and Javascript projects mentioned above are hosted on github and can be retrieved offline:

 

Now it’s time to modify ceph-mgr dashboard sources. The sources are located at /usr/lib/ceph/mgr/dashboard (at least on ubuntu)

The procedure is to:

  • copy the retrieved projects files in the static directory
  • modify base.html to have something like this:
<link rel="stylesheet" href="{{ url_prefix }}/static/Font-Awesome-4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="{{ url_prefix }}/static/ionicons-2.0.1/css/ionicons.min.css">
<script src="{{ url_prefix }}/static/moment-2.17.1/min/moment.min.js"></script>
<script src="{{ url_prefix }}/static/Chart.js-2.4.0/dist/Chart.min.js"></script>

Et voilà !

You now have a working dashboard.

Of course, all the modifications have been included in an ansible playbook to automate the deployment on all MGR nodes.