Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.

« Outils » : différence entre les versions

De EC_Wiki
Aucun résumé des modifications
Aucun résumé des modifications
 
(4 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
Retour [[Linux]] | [[Accueil]]
Retour [[Linux]] | [[Accueil]] | [[Architecture Infra Finale]]
 
== Étape 1 — Préparer le dossier de l’application ==
Création l’arborescence :
sudo mkdir -p /opt/outils/templates
sudo mkdir -p /opt/outils/static
 
== Étape 2 — Créer l’environnement Python ==
cd /opt/outils
sudo python3 -m venv venv
 
== Étape 3 — Installer Flask + Gunicorn ==
sudo /opt/outils/venv/bin/pip install flask gunicorn
 
== Étape 4 — Créer l’application Flask ==
Créer :
sudo nano /opt/outils/app.py
Puis mettre :
  from flask import Flask, render_template
 
  app = Flask(__name__)
 
  SERVICES = [
    {
        "name": "Nextcloud",
        "url": "https://cloud.ec-informatique.fr",
        "description": "Cloud personnel"
    },
    {
        "name": "MeshCentral",
        "url": "https://support.ec-informatique.fr",
        "description": "Support distant"
    },
    {
        "name": "Grafana",
        "url": "https://grafana.ec-informatique.fr",
        "description": "Monitoring"
    },
    {
        "name": "Wiki",
        "url": "https://wiki.ec-informatique.fr",
        "description": "Documentation infrastructure"
    },
  ]
 
  @app.route('/')
  def index():
    return render_template('index.html', services=SERVICES)
 
  if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5050)
 
== Étape 5 — Créer le template HTML ==
 
Créer :
sudo nano /opt/outils/templates/index.html
Puis :
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <title>Infrastructure EC-Informatique</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: #111827;
            color: white;
            margin: 40px;
        }
        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
        }
        .card {
            background: #1f2937;
            padding: 20px;
            border-radius: 10px;
        }
        a {
            color: #60a5fa;
            text-decoration: none;
        }
    </style>
</head>
<body>
<h1>Infrastructure EC-Informatique</h1>
<div class="grid">
{% for service in services %}
<div class="card">
    <h2>{{ service.name }}</h2>
    <p>{{ service.description }}</p>
    <a href="{{ service.url }}">
        Accéder
    </a>
</div>
{% endfor %}
</div>
</body>
</html>
== Étape 6 — Tester localement ==
 
Lancer :
cd /opt/outils
sudo /opt/outils/venv/bin/python app.py
 
On doit voir :
Running on http://0.0.0.0:5050
 
 


== Configuration Service ==
== Configuration Service ==

Dernière version du 14 mai 2026 à 14:27

Retour Linux | Accueil | Architecture Infra Finale

Étape 1 — Préparer le dossier de l’application modifier

Création l’arborescence :

sudo mkdir -p /opt/outils/templates
sudo mkdir -p /opt/outils/static

Étape 2 — Créer l’environnement Python modifier

cd /opt/outils

sudo python3 -m venv venv

Étape 3 — Installer Flask + Gunicorn modifier

sudo /opt/outils/venv/bin/pip install flask gunicorn

Étape 4 — Créer l’application Flask modifier

Créer :

sudo nano /opt/outils/app.py

Puis mettre :

 from flask import Flask, render_template
 
 app = Flask(__name__)
 
 SERVICES = [
    {
        "name": "Nextcloud",
        "url": "https://cloud.ec-informatique.fr",
        "description": "Cloud personnel"
    },
    {
        "name": "MeshCentral",
        "url": "https://support.ec-informatique.fr",
        "description": "Support distant"
    },
    {
        "name": "Grafana",
        "url": "https://grafana.ec-informatique.fr",
        "description": "Monitoring"
    },
    {
        "name": "Wiki",
        "url": "https://wiki.ec-informatique.fr",
        "description": "Documentation infrastructure"
    },
 ]
 
 @app.route('/')
 def index():
    return render_template('index.html', services=SERVICES)
 
 if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5050)

Étape 5 — Créer le template HTML modifier

Créer :

sudo nano /opt/outils/templates/index.html

Puis :

<!DOCTYPE html>
<html lang="fr">
<head>
   <meta charset="UTF-8">
   <title>Infrastructure EC-Informatique</title>

   <style>
       body {
           font-family: Arial, sans-serif;
           background: #111827;
           color: white;
           margin: 40px;
       }

       .grid {
           display: grid;
           grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
           gap: 20px;
       }

       .card {
           background: #1f2937;
           padding: 20px;
           border-radius: 10px;
       }

       a {
           color: #60a5fa;
           text-decoration: none;
       }
   </style>
</head>
<body>

Infrastructure EC-Informatique

{% for service in services %}
{% endfor %}

</body>
</html>

Étape 6 — Tester localement modifier

Lancer :

cd /opt/outils
sudo /opt/outils/venv/bin/python app.py

On doit voir :

Running on http://0.0.0.0:5050


Configuration Service modifier

En-tête modifier

Nom du service :
URL :
Fonction :
Type : 
Exposition :

Infrastructure modifier

Machine hôte : 
Docker / VM / service :
Port interne :
Dépendances :
Volumes :
Base de données :

Reverse proxy modifier

Vhost nginx :
Certificat SSL :
Proxy_pass :

Sauvegarde modifier

Méthode :
Fréquence :
Emplacement :

Sécurité modifier

Auth MFA :
VPN requis:
Fail2ban :
Firewall :