feat(article): conf serveur +

feat(config): noopener norefer on links +
fix(style): larger wrapper for editorial content +
fix(structure): add assets folder in src
This commit is contained in:
nicolas arduin 2025-01-29 15:23:19 +01:00
parent 202303f8f7
commit 0838ea9a47
Signed by: nicolas
SSH Key Fingerprint: SHA256:ELi8eDeNLl5PTn64G+o2Kx5+XVDfHF5um2tZigfwWkM
26 changed files with 143 additions and 51 deletions

View File

@ -1,14 +1,15 @@
export default new Map([ export default new Map([
["src/content/fragments/en/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fimage-full.mdx&astroContentModuleFlag=true")], ["src/content/fragments/fr/buttons.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fbuttons.mdx&astroContentModuleFlag=true")],
["src/content/fragments/en/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fsuper-cookies.mdx&astroContentModuleFlag=true")], ["src/content/fragments/fr/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fimage-full.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fsuper-cookies.mdx&astroContentModuleFlag=true")],
["src/content/articles/en/after-effects-expressions.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fafter-effects-expressions.mdx&astroContentModuleFlag=true")], ["src/content/articles/en/after-effects-expressions.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fafter-effects-expressions.mdx&astroContentModuleFlag=true")],
["src/content/articles/en/sci-hub-blocage.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fsci-hub-blocage.mdx&astroContentModuleFlag=true")], ["src/content/articles/en/sci-hub-blocage.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fsci-hub-blocage.mdx&astroContentModuleFlag=true")],
["src/content/articles/en/the-day-I-jamd.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fthe-day-I-jamd.mdx&astroContentModuleFlag=true")], ["src/content/articles/en/the-day-I-jamd.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fthe-day-I-jamd.mdx&astroContentModuleFlag=true")],
["src/content/articles/en/video-compression.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fvideo-compression.mdx&astroContentModuleFlag=true")], ["src/content/articles/en/video-compression.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Fen%2Fvideo-compression.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/buttons.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fbuttons.mdx&astroContentModuleFlag=true")], ["src/content/fragments/en/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fimage-full.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/image-full.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fimage-full.mdx&astroContentModuleFlag=true")], ["src/content/fragments/en/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Fen%2Fsuper-cookies.mdx&astroContentModuleFlag=true")],
["src/content/fragments/fr/super-cookies.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Ffragments%2Ffr%2Fsuper-cookies.mdx&astroContentModuleFlag=true")], ["src/content/articles/fr/configuration-serveur.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fconfiguration-serveur.mdx&astroContentModuleFlag=true")],
["src/content/articles/fr/the-day-I-jamd.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fthe-day-I-jamd.mdx&astroContentModuleFlag=true")], ["src/content/articles/fr/sci-hub-blocage.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fsci-hub-blocage.mdx&astroContentModuleFlag=true")],
["src/content/articles/fr/sci-hub-blocage.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fsci-hub-blocage.mdx&astroContentModuleFlag=true")]]); ["src/content/articles/fr/the-day-I-jamd.mdx", () => import("astro:content-layer-deferred-module?astro%3Acontent-layer-deferred-module=&fileName=src%2Fcontent%2Farticles%2Ffr%2Fthe-day-I-jamd.mdx&astroContentModuleFlag=true")]]);

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@ import { defineConfig } from 'astro/config'
import mdx from '@astrojs/mdx' import mdx from '@astrojs/mdx'
import sitemap from '@astrojs/sitemap' import sitemap from '@astrojs/sitemap'
import rehypeExternalLinks from 'rehype-external-links'
import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers' import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers'
import expressiveCode from 'astro-expressive-code' import expressiveCode from 'astro-expressive-code'
@ -15,6 +16,9 @@ export default defineConfig({
domains: ['assets.nardu.in'], domains: ['assets.nardu.in'],
remotePatterns: [{ protocol: 'https' }] remotePatterns: [{ protocol: 'https' }]
}, },
markdown: {
rehypePlugins: [[rehypeExternalLinks, { rel: ['noopener noreferer'] }]]
},
integrations: [ integrations: [
expressiveCode({ expressiveCode({
theme: 'one-dark-pro', theme: 'one-dark-pro',

BIN
bun.lockb

Binary file not shown.

View File

@ -17,6 +17,7 @@
"@expressive-code/plugin-line-numbers": "^0.40.1", "@expressive-code/plugin-line-numbers": "^0.40.1",
"astro": "5.1.8", "astro": "5.1.8",
"astro-expressive-code": "^0.40.1", "astro-expressive-code": "^0.40.1",
"rehype-external-links": "^3.0.0",
"sharp": "^0.33.5" "sharp": "^0.33.5"
}, },
"devDependencies": { "devDependencies": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 582 B

View File

Before

Width:  |  Height:  |  Size: 528 B

After

Width:  |  Height:  |  Size: 528 B

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

View File

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 429 B

View File

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 953 B

After

Width:  |  Height:  |  Size: 953 B

View File

Before

Width:  |  Height:  |  Size: 821 B

After

Width:  |  Height:  |  Size: 821 B

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

View File

@ -1,7 +1,7 @@
--- ---
import { Picture } from 'astro:assets' import { Picture } from 'astro:assets'
import SocialRel from '../components/SocialRel.astro' import SocialRel from '../components/SocialRel.astro'
import fight from '../images/fight-fascism.webp' import fight from '../assets/images/fight-fascism.webp'
--- ---
<footer class='footer wrapper flow' role='contentinfo'> <footer class='footer wrapper flow' role='contentinfo'>

View File

@ -9,9 +9,16 @@ type: articles
createdAt: '2025-01-28T22:20:00.000Z' createdAt: '2025-01-28T22:20:00.000Z'
--- ---
import { Picture } from 'astro:assets'
import coolifySettings from '@assets/images/articles/configuration-serveur/coolify-admin-settings.jpg'
import coolifyNewRessource from '@assets/images/articles/configuration-serveur/coolify-new-ressource.jpg'
import coolifyConfRessource from '@assets/images/articles/configuration-serveur/coolify-conf-ressource.jpg'
## Mon mémo perso. ## Mon mémo perso.
Cet article est l'extension d'un fichier «&nbsp;pense-bête&nbsp;» que j'utilise depuis toujours quand je créé un nouveau serveur, généralement un <abbr lang="en" title="Virtual Private Server">VPS</abbr>, généralment sous debian (ou fedora). Cet article est l'extension d'un fichier «&nbsp;pense-bête&nbsp;» que j'utilise depuis toujours quand je crée un nouveau serveur. Généralement un <abbr lang="en" title="Virtual Private Server">VPS</abbr>, généralement sous debian ou fedora.
Si vous voulez tester des trucs, voici [un lien de parrainage](https://hetzner.cloud/?ref=Jl7yPFuoBGDM) chez l'hébergeur allemand [Hetzner](https://hetzner.cloud) pour récupérer 20€ de crédit (et 10€ pour moi si vous y restez). [Conditions de l'offre.](https://www.hetzner.com/legal/referrals)
> Notez bien que je ne suis ni administrateur système ni expert en sécurité. > Notez bien que je ne suis ni administrateur système ni expert en sécurité.
@ -25,13 +32,13 @@ Se connecter en root via ssh puis…
Parfois il manque la configuration des [locales](https://www.tecmint.com/set-system-locales-in-linux/) et ça cause des erreurs. Parfois il manque la configuration des [locales](https://www.tecmint.com/set-system-locales-in-linux/) et ça cause des erreurs.
```bash ```bash {"Debian":4} {"Fedora":6}
# affiche la conf actuelle # affiche la conf actuelle
locale locale
# debian +
nano /etc/default/locale nano /etc/default/locale
# fedora +
nano /etc/locale.conf nano /etc/locale.conf
# compléter ces lignes si besoin # compléter ces lignes si besoin
@ -42,11 +49,11 @@ LC_ALL=en_US.UTF-8
#### Mettre à jour le système #### Mettre à jour le système
```bash ```bash {"Debian":1} {"Fedora":4}
# debian +
apt update apt update
apt dist-upgrade apt dist-upgrade
# fedora +
dnf check-update dnf check-update
dnf upgrade dnf upgrade
``` ```
@ -55,25 +62,25 @@ dnf upgrade
- Ajouter et renseigner un nouvel utilisateur. - Ajouter et renseigner un nouvel utilisateur.
- Ajouter l'utilisateur aux "sudoers". - Ajouter l'utilisateur aux "sudoers".
- Ajouter sa clé ssh à l'utilisateur. - Ajouter sa clé ssh locale à l'utilisateur distant.
```bash ```bash {"Debian":3} {"Fedora":5} {"En local":8} {"Sur le serveur":13}
adduser USERNAME adduser USERNAME
# debian +
usermod -aG sudo USERNAME usermod -aG sudo USERNAME
# fedora +
usermod -aG wheel USERNAME usermod -aG wheel USERNAME
# si pas encore de clé ssh EN LOCAL +
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -C "mail@domain.tld" ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -C "mail@domain.tld"
# copier la clé publique # afficher puis copier la clé publique
cat ~/.ssh/id_ed25519.pub cat ~/.ssh/id_ed25519.pub
# sur le serveur +
su USERNAME su USERNAME
mkdir ~/.ssh mkdir ~/.ssh
# coller la clé publique # coller la clé publique dans ce fichier
nano authorized_keys nano authorized_keys
``` ```
@ -156,26 +163,26 @@ firewall-cmd --reload
[Crowdsec](https://doc.crowdsec.net/docs/getting_started/install_crowdsec/) est un système de sécurité qui détecte et bloque les connexions malveillantes. [Crowdsec](https://doc.crowdsec.net/docs/getting_started/install_crowdsec/) est un système de sécurité qui détecte et bloque les connexions malveillantes.
- Installer crowdsec. - Installer crowdsec.
- Installer un "<span lang="en">bouncer</span>" - Installer un "<span lang="en">bouncer</span>".
- Activer des scenarios - Activer des [scenarios](https://doc.crowdsec.net/docs/next/cscli/cscli_scenarios_install) (facultatif).
```bash ```bash {"Debian":3} {"Fedora":6}
curl -s https://install.crowdsec.net | sudo sh curl -s https://install.crowdsec.net | sudo sh
# debian +
apt install crowdsec apt install crowdsec
apt install crowdsec-firewall-bouncer-iptables apt install crowdsec-firewall-bouncer-iptables
# fedora +
dnf install crowdsec dnf install crowdsec
dnf install crowdsec-firewall-bouncer-nftables dnf install crowdsec-firewall-bouncer-nftables
``` ```
## Conf web ## Conf web
**Partie encore en cours de rédaction.**
### Serveur web ### Serveur web
J'utilisais généralement [OpenLiteSpeed](https://openlitespeed.org/) pour avoir une interface graphique, mais j'ai changé pour [Coolify](https://coolify.io) depuis quelques années.
#### Coolify #### Coolify
[Documentation.](https://coolify.io/docs/installation) [Documentation.](https://coolify.io/docs/installation)
@ -184,15 +191,87 @@ dnf install crowdsec-firewall-bouncer-nftables
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash
``` ```
> Crowdsec et Coolify utilisent tous les deux le port 8080 par défaut. Il faut le changer pour un des deux (plus facile à [faire pour Crowdsec.](https://support.crowdsec.net/hc/en-gb/articles/10831013001234--Security-Engine-How-to-change-the-default-port))
<details class="flow">
<summary>Procédure détaillée</summary>
Il faut éditer deux fichiers:
```yaml title="/etc/crowdsec/config.yaml" "8080"
api:
server:
listen_uri: 127.0.0.1:8080
```
```yaml title="/etc/crowdsec/local_api_credentials.yaml" "8080"
url: http://127.0.0.1:8080
```
Puis charger la nouvelle configuration&nbsp;:
```bash
service crowdsec reload
```
</details>
##### Configuration
Une fois installé (suivre les instructions du script), on peut paramétrer Coolify avec un nom de domaine, généralement un sous-domaine du style `coolify.domaine.tld`
<Picture
src={coolifySettings}
formats={['avif', 'webp']}
alt="Instance's domain field inside settings"
/>
##### Ajouter une ressource
Dans coolify, les «&nbsp;ressources&nbsp;» correspondent à un site ou service web&nbsp;:
- site statique
- webapp
- base de données
- image docker
- etc.
Afin d'héberger un site ou une webapp «&nbsp;maison&nbsp;», il faudra avant tout que le code soit disponible sur une forge git. Soit en public soit en ayant paramétré une clé de déploiement au préalable.
<Picture src={coolifyNewRessource} formats={['avif', 'webp']} alt='' />
##### Configurer la ressource
Coolify va essayer de déterminer des [options par défaut](https://github.com/coollabsio/coolify-examples/) selon le dépôt git. Il ne restera plus qu'à ajuster les paramètres de la ressource&nbsp;:
- url du projet
- commande d'installation des paquets
- commande de construction du projet
- commande de démarrage
- variables d'environnement
- <span lang='en'>webhooks</span>
- etc.
<Picture src={coolifyConfRessource} formats={['avif', 'webp']} alt='' />
#### OpenLiteSpeed #### OpenLiteSpeed
[Documentation.](https://docs.openlitespeed.org/#CentOS_6_7_8_Debian_7_8_9_10_Ubuntu_1404_1604_1804_2004) Plus vraiment utilisé pour de nouveaux projets et moins évident à prendre en main. Mais puissant malgré tout&nbsp;!
[Documentation.](https://docs.openlitespeed.org/installation/repo/)
```bash
wget -O - https://repo.litespeed.sh | sudo bash
apt-get install openlitespeed
```
Récupérer le mot de passe admin `cat /usr/local/lsws/adminpasswd` Récupérer le mot de passe admin `cat /usr/local/lsws/adminpasswd`
### Outils ### Outils
Selon les besoins du projet&nbsp;:
- git - git
- [nvm](https://github.com/nvm-sh/nvm#install--update-script) - [nvm](https://github.com/nvm-sh/nvm#install--update-script)
- [yarn](https://classic.yarnpkg.com/en/docs/getting-started)/[pnpm](https://pnpm.io/installation)/[bun](https://bun.sh/) - [yarn](https://classic.yarnpkg.com/en/docs/getting-started)/[pnpm](https://pnpm.io/installation)/[bun](https://bun.sh/)
- [acme.sh](https://github.com/acmesh-official/acme.sh) ([tuto complet](https://www.nardu.in/fragments/acme-sh-tls-cert/)) - [acme.sh](https://github.com/acmesh-official/acme.sh) ([tuto complet](/fragments/acme-sh-tls-cert/))

View File

@ -56,7 +56,7 @@ h4,
h5, h5,
.h5 { .h5 {
font-size: var(--size-1); font-size: var(--size-0);
color: var(--primary-color); color: var(--primary-color);
} }

View File

@ -70,7 +70,9 @@ body {
max-inline-size: 100%; max-inline-size: 100%;
} }
:where(details) { :where(summary) {
padding: var(--space-3xs);
background-color: var(--color-light-grey);
cursor: pointer; cursor: pointer;
} }

View File

@ -22,6 +22,10 @@
grid-column: wrapper; grid-column: wrapper;
} }
.wrapper:has(article.editorial) {
--content-width: 70rem;
}
/* set full width content to full grid */ /* set full width content to full grid */
.wrapper.full-width { .wrapper.full-width {
/* calculate inline padding based on available space minus content space to align full-width content with wrapper content */ /* calculate inline padding based on available space minus content space to align full-width content with wrapper content */

View File

@ -6,7 +6,8 @@
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@components/*": ["src/components/*"], "@components/*": ["src/components/*"],
"@layouts/*": ["src/layouts/*"] "@layouts/*": ["src/layouts/*"],
"@assets/*": ["src/assets/*"]
}, },
"strictNullChecks": true, "strictNullChecks": true,
"plugins": [ "plugins": [