Skip to content

Commit

Permalink
Move to homer (#55)
Browse files Browse the repository at this point in the history
* Move to homer

see https://github.com/bastienwirtz/homer

* Linting fixes

* Linting fixes

* Removed duplicated Changelog

* prettier

* Reviewed changelog
  • Loading branch information
enolfc authored Aug 21, 2024
1 parent 36640a8 commit f3bef86
Show file tree
Hide file tree
Showing 15 changed files with 164 additions and 108 deletions.
12 changes: 0 additions & 12 deletions CHANGELOG

This file was deleted.

33 changes: 22 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Log of changes
## v0.0.5
- Dockerise the deployment.
## v0.0.4
- Add first version of CSS.
## v0.0.3
- Use a buffer (file on local disk) rather than querying GOCDB with every visit.
## v0.0.2
- First version working with [Apache](https://flask.palletsprojects.com/en/2.0.x/deploying/mod_wsgi/) on Ubuntu 20.04
## v0.0.1
- First version working with [Flask](https://flask.palletsprojects.com/en/2.0.x/quickstart/)
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.0] - 2024-08-21

### Changed

- Move to homer instead of dashy for the dashboard
- Adopt EGI colours

## [0.1] - 2022-07-28

### Added

- Initial dashboard implementation based on Dashy
58 changes: 28 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
# Contributing

Thank you for taking the time to contribute to this project.
The maintainers greatly appreciate the interest of contributors and rely on
continued engagement with the community to ensure that this project remains
useful.
We would like to take steps to put contributors in the best possible position
to have their contributions accepted.
Please take a few moments to read this short guide on how to contribute; bear
in mind that contributions regarding how to best contribute are also welcome.
Thank you for taking the time to contribute to this project. The maintainers
greatly appreciate the interest of contributors and rely on continued engagement
with the community to ensure that this project remains useful. We would like to
take steps to put contributors in the best possible position to have their
contributions accepted. Please take a few moments to read this short guide on
how to contribute; bear in mind that contributions regarding how to best
contribute are also welcome.

## Feedback and Questions

If you wish to discuss anything related to the project, please open an issue or
start a topic on the [EGI Community Forum](https://community.egi.eu).
The maintainers will sometimes move issues off of GitHub to the community forum
if it is thought that longer, more open-ended discussion would be beneficial,
start a topic on the [EGI Community Forum](https://community.egi.eu). The
maintainers will sometimes move issues off of GitHub to the community forum if
it is thought that longer, more open-ended discussion would be beneficial,
including a wider community scope.

## Contribution Process

Before proposing a contribution via pull request, ideally there is an open
issue describing the need for your contribution (refer to this issue number
when you submit the pull request). We have a 3 steps process for contributions.
Before proposing a contribution via pull request, ideally there is an open issue
describing the need for your contribution (refer to this issue number when you
submit the pull request). We have a 3 steps process for contributions.

1. Fork the project if you have not, and commit changes to a git branch
1. Create a GitHub Pull Request for your change, following the instructions
in the pull request template.
1. Create a GitHub Pull Request for your change, following the instructions in
the pull request template.
1. Perform a [Code Review](#code-review-process) with the maintainers on the
pull request.

### Pull Request Requirements

1. **Explain your contribution in plain language.** To assist the maintainers
in understanding and appreciating your pull request, please use the
template to explain _why_ you are making this contribution, rather than
just _what_ the contribution entails.
1. **Explain your contribution in plain language.** To assist the maintainers in
understanding and appreciating your pull request, please use the template to
explain _why_ you are making this contribution, rather than just _what_ the
contribution entails.

### Code Review Process

Code review takes place in GitHub pull requests. See [this
article](https://help.github.com/articles/about-pull-requests/) if you're not
familiar with GitHub Pull Requests.
Code review takes place in GitHub pull requests. See
[this article](https://help.github.com/articles/about-pull-requests/) if you're
not familiar with GitHub Pull Requests.

Once you open a pull request, maintainers will review your code using the
built-in code review process in Github PRs. The process at this point is as
Expand All @@ -55,14 +54,14 @@ follows:

For collaboration purposes, it is best if you create a GitHub account and fork
the repository to your own account. Once you do this you will be able to push
your changes to your GitHub repository for others to see and use, and it will
be easier to send pull requests.
your changes to your GitHub repository for others to see and use, and it will be
easier to send pull requests.

### Branches and Commits

You should submit your patch as a git branch named after the Github issue, such
as `#3`\. This is called a _topic branch_ and allows users to associate a
branch of code with the issue.
as `#3`\. This is called a _topic branch_ and allows users to associate a branch
of code with the issue.

It is a best practice to have your commit message have a _summary line_ that
includes the issue number, followed by an empty line and then a brief
Expand All @@ -82,9 +81,8 @@ purpose of changes to the code.

## Release cycle

Main branch is always available.
Tagged versions may be created as needed following [Semantic
Versioning](https://semver.org/) as far as applicable.
Main branch is always available. Tagged versions may be created as needed
following [Semantic Versioning](https://semver.org/) as far as applicable.

## Community

Expand Down
43 changes: 43 additions & 0 deletions assets/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
subtitle: "FedCloud Dashboards"
title: "EGI Cloud Compute"
logo: "assets/egi-logo.svg"

footer: |
<p><a href="https://www.egi.eu/service/cloud-compute/">Cloud Compute</a>
is a service delivered by the
<a href="https://www.egi.eu/egi-infrastructure/">EGI Infrastructure</a>
| This dashboard uses <a href="https://github.com/bastienwirtz/homer">
Homer</a></p>
theme: classic
# Optional custom stylesheet
# Will load custom CSS files. Especially useful for custom icon sets.
stylesheet:
- "assets/egi.css"
colors:
light:
highlight-secondary: "#005faa"
highlight-hover: "#ef8200"

message:
style: "is-dark" # See https://bulma.io/documentation/components/message/#colors for styling options.
title: "Provider dashboards"
icon: "fa fa-table-columns"
content: "You can find here link to the OpenStack dashboards of the EGI FedCloud providers"

links:
- name: "User documentation"
icon: "fas fa-book"
url: "https://docs.egi.eu/users/compute/cloud-compute/openstack/"
target: "_blank"
- name: "Provider documentation"
icon: "fas fa-book"
url: "https://docs.egi.eu/providers/cloud-compute/"
target: "_blank"

# Services
services:
- name: "OpenStack Dashboards"
icon: "fas fa-cloud"
items:
File renamed without changes
7 changes: 7 additions & 0 deletions assets/egi.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@charset "UTF-8";

/* Custom colors */
body #bighead .first-line {
background-color: #fff;
color: #005faa;
}
Binary file added assets/icons/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/favicon.ico
Binary file not shown.
File renamed without changes
Binary file added assets/icons/pwa-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/pwa-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"Fedcloud dashboard","short_name":"fedloud-dashboard","start_url":"../","display":"standalone","background_color":"#ffffff","lang":"en","scope":"../","description":"EGI Cloud Compute Fedcloud dashboard","theme_color":"#3367D6","icons":[{"src":"./icons/pwa-192x192.png","sizes":"192x192","type":"image/png"},{"src":"./icons/pwa-512x512.png","sizes":"512x512","type":"image/png"}]}
2 changes: 1 addition & 1 deletion cron-update-endpoints
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*/15 * * * * root /usr/local/bin/python /fedcloud-dashboard/dashboard/dashy_endpoints.py > /app/user-data/conf.yml
*/15 * * * * root /usr/local/bin/python /fedcloud-dashboard/dashboard/update_config.py > /www/assets/config.yml
102 changes: 54 additions & 48 deletions dashboard/dashy_endpoints.py → dashboard/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,46 @@

GOCDB_PUBLICURL = "https://goc.egi.eu/gocdbpi/public/"
DOCS_URL = "https://docs.egi.eu/users/compute/cloud-compute/openstack/"
TIMEOUT = 10
DASHY_OUTOUT = "dashy.output"
CONFIG_OUTPUT = "config.output"
CONFIG_TEMPLATE = {
"title": "EGI Cloud Compute",
"subtitle": "FedCloud Dashboards",
"theme": "classic",
"columns": "3",
"stylesheet": ["assets/egi.css"],
"colors": {
"light": {"highlight-hover": "#ef8200", "highlight-secondary": "#005faa"}
},
"links": [
{
"icon": "fas fa-book",
"name": "User documentation",
"target": "_blank",
"url": "https://docs.egi.eu/users/compute/cloud-compute/openstack/",
},
{
"icon": "fas fa-book",
"name": "Provider documentation",
"target": "_blank",
"url": "https://docs.egi.eu/providers/cloud-compute/",
},
],
"logo": "assets/egi-logo.svg",
"message": {
"content": "You can find here link to the OpenStack dashboards of "
"the EGI FedCloud providers",
"icon": "fa fa-table-columns",
"style": "is-dark",
"title": "Provider dashboards",
},
"services": [{"icon": "fas fa-cloud", "items": [], "name": "OpenStack Dashboards"}],
"footer": '<p><a href="https://www.egi.eu/service/cloud-compute/">Cloud '
"Compute</a> is a service delivered by the <a "
'href="https://www.egi.eu/egi-infrastructure/">EGI '
"Infrastructure</a> | This dashboard uses <a "
'href="https://github.com/bastienwirtz/homer">Homer</a>\n'
"</p>\n",
}


def get_sites():
Expand Down Expand Up @@ -90,64 +128,32 @@ def main():
"""
Main function, generates config
"""
dashy_conf = {
"pageInfo": {
"title": "EGI Cloud Compute",
"description": "FedCloud providers dashboards",
"navLinks": [
{
"title": "Documentation",
"path": DOCS_URL,
}
],
"logo": "/egi-logo.svg",
},
"appConfig": {
"theme": "material",
"layout": "horizontal",
"iconSize": "medium",
"language": "en",
"disableConfiguration": True,
},
"sections": [
{
"name": "OpenStack Dashboards",
"icon": "fas fa-clouds",
"items": [],
"displayData": {
"sortBy": "alphabetical",
"rows": 1,
"cols": 1,
"collapsed": False,
"hideForGuests": False,
},
},
],
}
config = CONFIG_TEMPLATE
try:
endpoints = find_endpoints("org.openstack.horizon")
items = dashy_conf["sections"][0]["items"]
items = config["services"][0]["items"]
for s in endpoints:
items.append(
{
"title": s[0],
"description": f"{s[3]} ({s[4]})",
"icon": "openstack.png",
"name": s[0],
"logo": "assets/icons/openstack.png",
"subtitle": f"{s[3]} ({s[4]})",
"tag": s[4],
"target": "_blank",
"url": s[2],
"target": "newtab",
}
)
print(yaml.dump(dashy_conf))
with open(DASHY_OUTOUT, "w", encoding="utf-8") as f:
yaml.dump(dashy_conf, f)
print(yaml.dump(config))
with open(CONFIG_OUTPUT, "w", encoding="utf-8") as f:
yaml.dump(config, f)
# catching anything, we don't need to be specific
except Exception: # pylint: disable=broad-exception-caught
if Path(DASHY_OUTOUT).is_file():
with open(DASHY_OUTOUT, "r", encoding="utf-8") as f:
if Path(CONFIG_OUTPUT).is_file():
with open(CONFIG_OUTPUT, "r", encoding="utf-8") as f:
print(yaml.dump(yaml.safe_load(f)))
else:
# to-do: write in dashy_conf: "site not available at the moment"
print(yaml.dump(dashy_conf))
# to-do: write in config: "site not available at the moment"
print(yaml.dump(config))


if __name__ == "__main__":
Expand Down
14 changes: 8 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
image: "traefik:v2.11"
container_name: "traefik"
command:
# - "--log.level=DEBUG"
# - "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
Expand All @@ -17,7 +17,7 @@ services:
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
# #- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=enol.fernandez@egi.eu"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
Expand All @@ -33,22 +33,24 @@ services:


dashboard:
image: "lissy93/dashy:3.x"
image: "b4bz/homer:v24.05.1"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`${DASHBOARD_HOSTNAME}`)"
- "traefik.http.routers.dashboard.rule=HostRegexp(`{any:.+}`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls.certresolver=myresolver"
volumes:
- "/fedcloud-dashboard/user-data:/app/user-data/"
- "/fedcloud-dashboard/assets:/www/assets/"
environment:
- INIT_ASSETS=1
deploy:
restart_policy:
condition: any

endpoint_updater:
build: .
volumes:
- "/fedcloud-dashboard/user-data:/app/user-data/"
- "/fedcloud-dashboard/assets:/www/assets/"
deploy:
restart_policy:
condition: any
Expand Down

0 comments on commit f3bef86

Please sign in to comment.