Introduction
For fun and to develop my skills, I want to get my website back online. It was running on Gatsby, a framework for React. It worked great, but a new version hasn't been released in over a year. So, I decided to start fresh and create a new website using Next.js, allowing me to learn a new technology. Here’s how I did it.
download a basic nextjs template
Quick tutorial of nextjs
https://nextjs.org/learn-pages-router/basics/create-nextjs-app
Source of the template
https://github.com/vercel/next-learn/tree/main/basics/demo
next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
unoptimized: true,
},
output: 'export',
}
export default nextConfig
Create this file in the root folder
what is this file doing
.gitlab-ci.yml
What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format, commonly used for configuration files. A data serialization format is a way to structure and store data so that it can be easily shared between different systems or applications. YAML organizes data in a clean and simple way, making it easy to read and write.
What is this file?
The .gitlab-ci.yml
file is a configuration file that tells GitLab how to deploy your website. It contains instructions for GitLab’s CI/CD (Continuous Integration/Continuous Deployment) pipeline, guiding it through the process of building, testing, and deploying your application.
Creating a Connection with a Domain Name
- Click on New Pages Domain.
- Set the Domain field to your domain name, for example, “www.quentinparrot.com”.
- If you don’t already have an SSL certificate, leave Automatic certificate management using Let’s Encrypt checked.
- Click on Create New Domain.
OVH - DNS configuration
Create DNS record
For subdomain
- In your OVH dashboard, select the DNS zones tab, and click on Add an entry
- Select CNAME
- Set the same subdomain as defined in the Gitlab pages configurations
- Set the target as indicated by the Gitlab page myGitlabUsername.gitlab.io.. Do not forget the period at the end
- Click on next and valipublishedAt
Verify ownership
- Select TXT field type
- In subdomain, enter _gitlab-pages-verification-code.www
- Set value to gitlab-pages-verification-code=xxxxxxxxxxxxxxxxxxxxxxxxx
- In your Gitlab page configuration,
- Wait (a few minutes later, or hours)
- Click on the arrow next to “Unverified” (retry verification), the status should switch to “verified”
German version
Einführung
Aus Spaß und um meine Fähigkeiten weiterzuentwickeln, möchte ich meine Website wieder online bringen. Sie lief auf Gatsby, einem Framework für React. Es funktionierte großartig, aber es wurde seit über einem Jahr keine neue Version veröffentlicht. Daher habe ich mich entschieden, von vorne anzufangen und eine neue Website mit Next.js zu erstellen, um eine neue Technologie zu erlernen. So habe ich es gemacht.
Herunterladen einer einfachen Next.js-Vorlage
Kurzanleitung zu Next.js
https://nextjs.org/learn-pages-router/basics/create-nextjs-app
Quelle der Vorlage
https://github.com/vercel/next-learn/tree/main/basics/demo
next.config.mjs
js
Copy code
/** @type {import('next').NextConfig} */ const nextConfig = { images: { unoptimized: true, }, output: 'export', } export default nextConfig
Erstelle diese Datei im Stammordner.
Was macht diese Datei?
.gitlab-ci.yml
Was ist YAML?
YAML (YAML Ain't Markup Language) ist ein menschenlesbares Datenserialisierungsformat, das häufig für KonfigurationspublishedAtien verwendet wird. Ein Datenserialisierungsformat strukturiert und speichert Daten so, dass sie einfach zwischen verschiedenen Systemen oder Anwendungen geteilt werden können. YAML organisiert Daten auf eine einfache und übersichtliche Weise, was das Lesen und Schreiben erleichtert.
Was ist diese Datei?
Die .gitlab-ci.yml
-Datei ist eine KonfigurationspublishedAti, die GitLab mitteilt, wie Ihre Website bereitgestellt werden soll. Sie enthält Anweisungen für die CI/CD-Pipeline (Continuous Integration/Continuous Deployment) von GitLab und führt durch den Prozess des Buildens, Testens und Bereitstellens der Anwendung.
Eine Verbindung mit einem Domain-Namen herstellen
- Klicken Sie auf Neue Pages-Domain.
- Setzen Sie das Feld Domain auf Ihren Domain-Namen, z. B. "www.quentinparrot.com".
- Wenn Sie noch kein SSL-Zertifikat haben, lassen Sie Automatische Zertifikatsverwaltung mit Let's Encrypt aktiviert.
- Klicken Sie auf Neue Domain erstellen.
OVH - DNS-Konfiguration
DNS-Eintrag erstellen
Für eine Subdomain:
- Wählen Sie in Ihrem OVH-Dashboard den Reiter DNS-Zonen und klicken Sie auf Einen Eintrag hinzufügen.
- Wählen Sie CNAME.
- Setzen Sie die gleiche Subdomain, die Sie in den GitLab Pages-Konfigurationen definiert haben.
- Setzen Sie das Ziel auf die von GitLab Pages angegebene Adresse, z. B. myGitlabUsername.gitlab.io. (Vergessen Sie das Punktzeichen am Ende nicht).
- Klicken Sie auf Weiter und bestätigen Sie.
Eigentümerschaft verifizieren
- Wählen Sie den Feldtyp TXT.
- Geben Sie im Feld Subdomain folgendes ein: _gitlab-pages-verification-code.www.
- Setzen Sie den Wert auf gitlab-pages-verification-code=xxxxxxxxxxxxxxxxxxxxxxxxx.
- Fügen Sie diesen Wert in Ihre GitLab Pages-Konfiguration ein.
- Warten Sie (einige Minuten oder Stunden).
- Klicken Sie auf den Pfeil neben "Nicht verifiziert" (erneut versuchen), und der Status sollte auf "Verifiziert" wechseln.
Ressourcen
Resources
https://www.nicosauvage.fr/posts/ovh-gitlab-pages/ connect with a domain