Compare commits
28 Commits
main
...
ad47b58ad3
| Author | SHA1 | Date | |
|---|---|---|---|
| ad47b58ad3 | |||
| 7f1c132eb7 | |||
| 53eb3983f7 | |||
| cb52c3e44b | |||
| 302efae864 | |||
| e48061c252 | |||
| eacb6dff58 | |||
| 6a1fca0765 | |||
| 503b8a256c | |||
| 2ceadbd287 | |||
| 7fc1a58c3f | |||
| e0f111b3b3 | |||
| b106942423 | |||
| 3fcf74f311 | |||
| 41c383ca5a | |||
| 5f36244db1 | |||
| 782ff9e69d | |||
| 64ea65deba | |||
| ae5d2e52aa | |||
| 52da2c79d6 | |||
| 3900dcda2a | |||
| a36c59f6fb | |||
| 287ec5c477 | |||
| 009d37569f | |||
| 6c99ed7544 | |||
| 9b0b99b12a | |||
| c1bfbcceca | |||
| d3c7ff924a |
142
.gitea/workflows/deploy-preprod.yml
Normal file
142
.gitea/workflows/deploy-preprod.yml
Normal file
@@ -0,0 +1,142 @@
|
||||
name: Deploy Roxane to Preprod
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: docker
|
||||
|
||||
container:
|
||||
image: nebulaed/php83-node22
|
||||
|
||||
steps:
|
||||
- name: Install network & SSH tools
|
||||
run: |
|
||||
set -e
|
||||
apt update
|
||||
apt install -y iproute2 iputils-ping openssh-client git
|
||||
|
||||
- name: Show IPv6 network
|
||||
run: |
|
||||
ip -6 addr
|
||||
ip -6 route
|
||||
|
||||
- name: Ping IPv6 preprod server
|
||||
run: |
|
||||
ping6 -c 3 2a01:e0a:bfe:a8a0::205
|
||||
|
||||
- name: Configure SSH
|
||||
env:
|
||||
SSH_HOST: ${{ vars.PREPROD_HOST }}
|
||||
SSH_PORT: ${{ vars.PREPROD_PORT }}
|
||||
run: |
|
||||
set -e
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
|
||||
ssh-keyscan -6 -p "$SSH_PORT" "$SSH_HOST" >> ~/.ssh/known_hosts
|
||||
|
||||
echo "SSH_HOST_SSH=$SSH_HOST" >> "$GITEA_ENV"
|
||||
|
||||
- name: Deploy Roxane to preprod
|
||||
env:
|
||||
SSH_USER: ${{ vars.PREPROD_USER }}
|
||||
SSH_PORT: ${{ vars.PREPROD_PORT }}
|
||||
PREPROD_PATH: ${{ vars.PREPROD_PATH }}
|
||||
GIT_REPO: ${{ vars.GIT_REPO }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
ssh -6 -o StrictHostKeyChecking=yes \
|
||||
-o ConnectTimeout=10 \
|
||||
-o ServerAliveInterval=60 \
|
||||
-p "$SSH_PORT" \
|
||||
"$SSH_USER@$SSH_HOST_SSH" bash -l -s <<'EOF' "$PREPROD_PATH" "$GIT_REPO"
|
||||
set -e
|
||||
|
||||
PREPROD_PATH="$1"
|
||||
GIT_REPO="$2"
|
||||
|
||||
# Vérifier si le dépôt existe, sinon le cloner
|
||||
if [ ! -d "$PREPROD_PATH/.git" ]; then
|
||||
echo "[!] Repository not found. Cloning from $GIT_REPO..."
|
||||
mkdir -p "$(dirname "$PREPROD_PATH")"
|
||||
git clone "$GIT_REPO" "$PREPROD_PATH"
|
||||
cd "$PREPROD_PATH"
|
||||
git checkout release
|
||||
else
|
||||
cd "$PREPROD_PATH"
|
||||
git config --global --add safe.directory "$PREPROD_PATH" 2>/dev/null || true
|
||||
|
||||
echo "[>>] Pulling latest Roxane release..."
|
||||
git fetch origin
|
||||
git checkout release
|
||||
git reset --hard origin/release
|
||||
git clean -fd # Nettoyer les fichiers non trackés
|
||||
fi
|
||||
|
||||
echo "[*] Installing Composer dependencies..."
|
||||
composer install --no-dev --optimize-autoloader --no-interaction --prefer-dist
|
||||
|
||||
echo "[~] Building frontend with Vite..."
|
||||
npm ci --prefer-offline
|
||||
npm run build
|
||||
|
||||
echo "[DB] Running database migrations..."
|
||||
php artisan migrate --force
|
||||
|
||||
echo "[++] Optimizing Roxane..."
|
||||
php artisan config:cache
|
||||
php artisan route:cache
|
||||
php artisan view:cache
|
||||
php artisan event:cache
|
||||
|
||||
echo "[<>] Restarting queue workers..."
|
||||
php artisan queue:restart || true
|
||||
|
||||
echo "[OK] Roxane deployed successfully to preprod!"
|
||||
EOF
|
||||
|
||||
- name: Verify deployment
|
||||
if: success()
|
||||
env:
|
||||
SSH_USER: ${{ vars.PREPROD_USER }}
|
||||
SSH_PORT: ${{ vars.PREPROD_PORT }}
|
||||
PREPROD_PATH: ${{ vars.PREPROD_PATH }}
|
||||
run: |
|
||||
ssh -6 -o StrictHostKeyChecking=yes \
|
||||
-p "$SSH_PORT" \
|
||||
"$SSH_USER@$SSH_HOST_SSH" bash -l -s <<'EOF' "$PREPROD_PATH"
|
||||
set -e
|
||||
cd "$1"
|
||||
|
||||
echo "[?] Verifying deployment..."
|
||||
echo "Current branch: $(git branch --show-current)"
|
||||
echo "Last commit: $(git log -1 --oneline)"
|
||||
echo "Laravel version: $(php artisan --version)"
|
||||
EOF
|
||||
|
||||
- name: Cleanup on failure
|
||||
if: failure()
|
||||
env:
|
||||
SSH_USER: ${{ vars.PREPROD_USER }}
|
||||
SSH_PORT: ${{ vars.PREPROD_PORT }}
|
||||
PREPROD_PATH: ${{ vars.PREPROD_PATH }}
|
||||
run: |
|
||||
ssh -6 -o StrictHostKeyChecking=yes \
|
||||
-p "$SSH_PORT" \
|
||||
"$SSH_USER@$SSH_HOST_SSH" bash -l -s <<'EOF' "$PREPROD_PATH"
|
||||
cd "$1"
|
||||
|
||||
echo "[!!] Deployment failed. Rolling back optimizations..."
|
||||
php artisan config:clear || true
|
||||
php artisan route:clear || true
|
||||
php artisan view:clear || true
|
||||
php artisan cache:clear || true
|
||||
EOF
|
||||
29
resources/js/pages/maintenance.tsx
Normal file
29
resources/js/pages/maintenance.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
export default function MaintenancePage() {
|
||||
const [dark, setDark] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (dark) {
|
||||
document.documentElement.classList.add("dark");
|
||||
} else {
|
||||
document.documentElement.classList.remove("dark");
|
||||
}
|
||||
}, [dark]);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col items-center justify-center bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100 p-6 transition-colors duration-300">
|
||||
<button
|
||||
onClick={() => setDark(!dark)}
|
||||
className="absolute top-4 right-4 px-3 py-1 rounded-xl border border-gray-400 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800 transition"
|
||||
>
|
||||
{dark ? "☀️ Mode clair" : "🌙 Mode sombre"}
|
||||
</button>
|
||||
|
||||
<h1 className="text-4xl font-bold mb-4 text-center">Site en cours de construction</h1>
|
||||
<p className="text-lg text-center max-w-xl">
|
||||
Le Retzien Libre se refait une beauté. Le site sera visible très bientôt.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ logout.form = logoutForm
|
||||
|
||||
/**
|
||||
* @see routes/web.php:6
|
||||
* @route '/'
|
||||
* @route '/welcome'
|
||||
*/
|
||||
export const home = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: home.url(options),
|
||||
@@ -147,12 +147,12 @@ export const home = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
|
||||
home.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/',
|
||||
url: '/welcome',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see routes/web.php:6
|
||||
* @route '/'
|
||||
* @route '/welcome'
|
||||
*/
|
||||
home.url = (options?: RouteQueryOptions) => {
|
||||
return home.definition.url + queryParams(options)
|
||||
@@ -160,7 +160,7 @@ home.url = (options?: RouteQueryOptions) => {
|
||||
|
||||
/**
|
||||
* @see routes/web.php:6
|
||||
* @route '/'
|
||||
* @route '/welcome'
|
||||
*/
|
||||
home.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: home.url(options),
|
||||
@@ -169,7 +169,7 @@ home.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
|
||||
/**
|
||||
* @see routes/web.php:6
|
||||
* @route '/'
|
||||
* @route '/welcome'
|
||||
*/
|
||||
home.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: home.url(options),
|
||||
@@ -178,7 +178,7 @@ home.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
|
||||
/**
|
||||
* @see routes/web.php:6
|
||||
* @route '/'
|
||||
* @route '/welcome'
|
||||
*/
|
||||
const homeForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: home.url(options),
|
||||
@@ -187,7 +187,7 @@ const homeForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
|
||||
/**
|
||||
* @see routes/web.php:6
|
||||
* @route '/'
|
||||
* @route '/welcome'
|
||||
*/
|
||||
homeForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: home.url(options),
|
||||
@@ -196,7 +196,7 @@ homeForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
|
||||
/**
|
||||
* @see routes/web.php:6
|
||||
* @route '/'
|
||||
* @route '/welcome'
|
||||
*/
|
||||
homeForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: home.url({
|
||||
@@ -211,7 +211,81 @@ homeForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
home.form = homeForm
|
||||
|
||||
/**
|
||||
* @see routes/web.php:11
|
||||
* @see routes/web.php:10
|
||||
* @route '/'
|
||||
*/
|
||||
export const maintenance = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: maintenance.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
maintenance.definition = {
|
||||
methods: ["get","head"],
|
||||
url: '/',
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see routes/web.php:10
|
||||
* @route '/'
|
||||
*/
|
||||
maintenance.url = (options?: RouteQueryOptions) => {
|
||||
return maintenance.definition.url + queryParams(options)
|
||||
}
|
||||
|
||||
/**
|
||||
* @see routes/web.php:10
|
||||
* @route '/'
|
||||
*/
|
||||
maintenance.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
url: maintenance.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:10
|
||||
* @route '/'
|
||||
*/
|
||||
maintenance.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
url: maintenance.url(options),
|
||||
method: 'head',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:10
|
||||
* @route '/'
|
||||
*/
|
||||
const maintenanceForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: maintenance.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:10
|
||||
* @route '/'
|
||||
*/
|
||||
maintenanceForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: maintenance.url(options),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:10
|
||||
* @route '/'
|
||||
*/
|
||||
maintenanceForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
action: maintenance.url({
|
||||
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||||
_method: 'HEAD',
|
||||
...(options?.query ?? options?.mergeQuery ?? {}),
|
||||
}
|
||||
}),
|
||||
method: 'get',
|
||||
})
|
||||
|
||||
maintenance.form = maintenanceForm
|
||||
|
||||
/**
|
||||
* @see routes/web.php:15
|
||||
* @route '/dashboard'
|
||||
*/
|
||||
export const dashboard = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
@@ -225,7 +299,7 @@ dashboard.definition = {
|
||||
} satisfies RouteDefinition<["get","head"]>
|
||||
|
||||
/**
|
||||
* @see routes/web.php:11
|
||||
* @see routes/web.php:15
|
||||
* @route '/dashboard'
|
||||
*/
|
||||
dashboard.url = (options?: RouteQueryOptions) => {
|
||||
@@ -233,7 +307,7 @@ dashboard.url = (options?: RouteQueryOptions) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see routes/web.php:11
|
||||
* @see routes/web.php:15
|
||||
* @route '/dashboard'
|
||||
*/
|
||||
dashboard.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
@@ -242,7 +316,7 @@ dashboard.get = (options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:11
|
||||
* @see routes/web.php:15
|
||||
* @route '/dashboard'
|
||||
*/
|
||||
dashboard.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
@@ -251,7 +325,7 @@ dashboard.head = (options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:11
|
||||
* @see routes/web.php:15
|
||||
* @route '/dashboard'
|
||||
*/
|
||||
const dashboardForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
@@ -260,7 +334,7 @@ const dashboardForm = (options?: RouteQueryOptions): RouteFormDefinition<'get'>
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:11
|
||||
* @see routes/web.php:15
|
||||
* @route '/dashboard'
|
||||
*/
|
||||
dashboardForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
@@ -269,7 +343,7 @@ dashboardForm.get = (options?: RouteQueryOptions): RouteFormDefinition<'get'> =>
|
||||
})
|
||||
|
||||
/**
|
||||
* @see routes/web.php:11
|
||||
* @see routes/web.php:15
|
||||
* @route '/dashboard'
|
||||
*/
|
||||
dashboardForm.head = (options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Inertia\Inertia;
|
||||
|
||||
Route::get('/', function () {
|
||||
Route::get('/welcome', function () {
|
||||
return Inertia::render('welcome');
|
||||
})->name('home');
|
||||
|
||||
Route::get('/', function () {
|
||||
return Inertia::render('maintenance');
|
||||
})->name('maintenance');
|
||||
|
||||
Route::middleware(['auth', 'verified'])->group(function () {
|
||||
Route::get('dashboard', function () {
|
||||
return Inertia::render('dashboard');
|
||||
|
||||
Reference in New Issue
Block a user