Fork me on GitHub

Herr Knedel/Grandi cose con i container: KPI Dashboard

Created Mon, 21 Mar 2022 00:00:00 +0000 Modified Sat, 02 Apr 2022 15:12:13 +0000 Schwierigkeitsgrad: Es kann etwas länger dauern

405 Words

Soprattutto nell’era Corona, con il lavoro decentralizzato, le informazioni aggiornate sono molto richieste in tutte le sedi. Io stesso ho già impostato innumerevoli sistemi informativi e vorrei presentare un ottimo software chiamato Smashing.Speaker: https://smashing.github.io/Das Il progetto Smashing è stato originariamente sviluppato con il nome di Dashing dalla società Shopify per la presentazione di cifre aziendali. Ma ovviamente non si possono mostrare solo le cifre degli affari. Sviluppatori di tutto il mondo hanno sviluppato Smashing tiles, i cosiddetti widget, per Gitlab, Jenkins, Bamboo, Jira, ecc., vedi:https://github.com/Smashing/smashing/wiki/Additional-WidgetsDoch come ci si lavora?

Passo 1: creare l’immagine di base

Per prima cosa, creo una semplice immagine Docker che include già Ruby e Dashing.

x
+
Terminal

$ mkdir dashing-project
$ cd dashing-project
$ mkdir dashboard
$ vim Dockerfile

Questo è il primo contenuto che scrivo nel file Dockerfile:

From ubuntu:latest
 
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

COPY dashboard/ /code/

RUN apt-get update && apt-get install -y ruby wget unzip ruby-dev build-essential tzdata nodejs && \
gem install smashing && \
apt-get clean

Poi creo l’immagine Docker con questo comando:

x
+
Terminal

$ docker build -t my-dashboard:latest .

Questo è quello che sembra per me:

Passo 2: Creare il cruscotto

Ora posso creare una nuova dashboard con il seguente comando:

x
+
Terminal

$ docker run -it -v /path/to/my/dashing-project:/code my-dashboard:latest smashing new dashboard

Dopo di che, la cartella “dashboard” nel progetto Dashing dovrebbe apparire come questa: Molto bene! Ora devo aggiornare nuovamente il Dockerfile. Il nuovo contenuto è questo:

From ubuntu:latest
 
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 
COPY dashboard/ /code/
 
RUN apt-get update && apt-get install -y ruby wget unzip ruby-dev build-essential tzdata nodejs && \
gem install smashing && \
gem install bundler && \
apt-get clean
 
RUN cd /code/ && \
bundle
 
RUN chown -R www-data:www-data  /code/

USER www-data
WORKDIR /code/

EXPOSE 3030

CMD ["/usr/local/bin/bundle", "exec", "puma", "config.ru"]

Inoltre, anche il file Gemfile nella cartella “dashboard” deve essere adattato:

source 'https://rubygems.org'

gem 'smashing'
gem 'puma'

Ripeto il comando di costruzione:

x
+
Terminal

$ docker build -t my-dashboard:latest .

Ora posso avviare la mia nuova dashboard per la prima volta e accedervi su http://localhost:9292.
x
+
Terminal

$ docker run -it -p 9292:9292 my-dashboard:latest

E questo è il suo aspetto: Questa è la base di un buon sistema informativo. È possibile personalizzare tutto il colore, gli script e i widget.