Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/CD rework to drop netlify #12

Merged
merged 40 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
91d40b0
Create main.yml
Xabi08YT Jan 5, 2025
f4a2ec7
Added preview script, corrected main script name
Xabi08YT Jan 5, 2025
f327c3d
Updated preview script to ditch Github CLI
Xabi08YT Jan 5, 2025
54c395b
removing line that caused the script to crash
Xabi08YT Jan 5, 2025
a4b8b21
Added small test to ensure we are pulling the right thing. Will be re…
Xabi08YT Jan 5, 2025
968c336
Pulled the right thing, removing test. Added files for podman
Xabi08YT Jan 5, 2025
58c8993
Corrected auto deploy script
Xabi08YT Jan 5, 2025
b80dd75
Renamed dockerfile
Xabi08YT Jan 5, 2025
dddf5f7
Correcting dockerfile
Xabi08YT Jan 5, 2025
36e9ca4
Added root url to support reverse proxy custom paths
Xabi08YT Jan 5, 2025
b701a9c
Added forgotten commas
Xabi08YT Jan 5, 2025
d3e2c48
Test for images
Xabi08YT Jan 5, 2025
1a78c88
Test to import images as ES modules. Switched the proxy from nuxt to …
Xabi08YT Jan 5, 2025
20f468f
Test image import from bg
Xabi08YT Jan 5, 2025
9a3b26b
Corrected image paths
Xabi08YT Jan 5, 2025
0e41cf8
Added cleanup steps
Xabi08YT Jan 5, 2025
68d0a34
Removed sudo because sudo is not needed and user is not sudoer.
Xabi08YT Jan 5, 2025
ffd562b
Corrected proxying for hyperplanning
Xabi08YT Jan 5, 2025
b30dbc6
Replaced every image link with a valid one.
Xabi08YT Jan 5, 2025
88311ad
Added logo for new year
Xabi08YT Jan 5, 2025
9525566
Attempt to fix plannings. Fixed bad image link
Xabi08YT Jan 5, 2025
f579ba6
Corrected link to build
Xabi08YT Jan 5, 2025
e7bd3bb
Same as last commit but just because of one capital letter >:(
Xabi08YT Jan 5, 2025
228b682
Attempt to correct plannings and allow the code to compile
Xabi08YT Jan 5, 2025
604ec67
Added failing condition to deploys
Xabi08YT Jan 5, 2025
73e173d
Test to see if what i am trying to correct is really the problem :/
Xabi08YT Jan 5, 2025
31c588d
2nd test that SHOULD pass
Xabi08YT Jan 5, 2025
95de8db
NO >:( Driving me crazy
Xabi08YT Jan 5, 2025
8acfb97
Tried to switch the page to client side
Xabi08YT Jan 5, 2025
308f094
Testing with everything on server side
Xabi08YT Jan 5, 2025
c13e680
May have found the problem. Sending test fix
Xabi08YT Jan 5, 2025
3fc7793
Import fix
Xabi08YT Jan 5, 2025
d695fea
Correction attempt for planning url
Xabi08YT Jan 5, 2025
50a5b33
Test to see everything working (or not)
Xabi08YT Jan 5, 2025
b9d39b2
Test for menus
Xabi08YT Jan 5, 2025
4999a56
Test fixes for HP and menus
Xabi08YT Jan 5, 2025
d02d24a
missing async fix
Xabi08YT Jan 5, 2025
a9c44b2
Multiple fixes in crous menus.
Xabi08YT Jan 5, 2025
41fcf17
Fully repaired menus.
Xabi08YT Jan 5, 2025
9d8c359
Fixed plannings. Things should be ready to merge. Code unhacked.
Xabi08YT Jan 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.previewConfigs
.eslintrc.js
.gitignore
CONTRIBUTING.md
netlify.toml
RASPBERRY.md
README.md
.github
node_modules
compose.yaml
DOCKERFILE
36 changes: 36 additions & 0 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy over SSH
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
port: ${{ secrets.PORT }}
script: |
echo "Using correct folder..."
cd info
echo "Pulling changes..."
git pull
echo "Building container image..."
podman build -t onboarding-info:latest .
if [[ $? -ne 0 ]] ; then
echo "Failed, Cleaning up..."
podman image ls -a | grep '<none>' | awk '{print $3}' | xargs podman rmi -f
exit 1
fi
echo "Shutting down and deleting old containers..."
podman-compose down
echo "Bringing up new containers with the latest released code..."
podman-compose up -d
echo "Cleaning up..."
podman image ls -a | grep '<none>' | awk '{print $3}' | xargs podman rmi -f
49 changes: 49 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy preview over SSH
on: [pull_request]
jobs:
deploy:
name: Deploy preview
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.2.0
env:
PR_NUMBER: ${{ github.event.number }}
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
port: ${{ secrets.PORT }}
envs: PR_NUMBER
script: |
echo "Removing previous preview data..."
rm -rf preview-info
podman image rm
echo "Cloning preview..."
git clone https://github.com/Xabi08YT/iut-onboarding.git preview-info
echo "Using correct folder..."
cd preview-info
echo "Switching to right PR..."
git fetch origin pull/$PR_NUMBER/head:PREVIEW
git switch PREVIEW
echo "Copying .env file..."
cp ../../.env.info ../.env
echo "Using preview config for nuxt..."
rm nuxt.config.js
cp .previewConfigs/devnuxt.config.js ./nuxt.config.js
echo "Building container image..."
podman build -t onboarding-info-preview:latest .
if [[ $? -ne 0 ]] ; then
echo "Failed, Cleaning up..."
podman image ls -a | grep '<none>' | awk '{print $3}' | xargs podman rmi -f
exit 1
fi
echo "Using preview podman configs..."
cd .previewConfigs
echo "Shutting down and deleting old previews..."
podman-compose down
echo "Bringing up new preview..."
podman-compose up -d
echo "Cleaning up..."
podman image ls -a | grep '<none>' | awk '{print $3}' | xargs podman rmi -f
12 changes: 12 additions & 0 deletions .previewConfigs/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
networks:
proxy:
external: true

services:
previewInfo:
container_name: infopreview
image: onboarding-info-preview:latest
restart: unless-stopped
networks:
proxy:
ipv4_address: 10.89.1.151
29 changes: 29 additions & 0 deletions .previewConfigs/devnuxt.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default {
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
modules: ['@nuxtjs/google-fonts'],

app: {
baseURL: '/preview/info/'
},

googleFonts: {
display: 'swap',
outputDir: 'assets/fonts/',
families: {
Fredoka: {
wght: ["75..125",500]
},
Poppins: {
wght: 300
}
}
},

routeRules: {
"/api/hp/**": {
proxy: "https://hyperplanning.iut.u-bordeaux.fr/Telechargements/ical/**"
}
}
};
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM docker.io/node:20-alpine
WORKDIR /server
COPY . /server
RUN npm ci
RUN npm run build
CMD node .output/server/index.mjs
9 changes: 0 additions & 9 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ export const getTBMLineWaitInterval = async (stopId, lineId) => {
}
};

export const getAllRestaurantsMenus = async () => {
try {
const result = await fetch(".netlify/functions/getCrousMenus");
return await result.json();
} catch (e) {
throw `Erreur de récupération des menus CROUS : ${e}`;
}
};

const transformDesc = (desc) => {
if(desc.length === 0) {
return ;
Expand Down
6 changes: 3 additions & 3 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
:isActive="currentView == 'menus'"
/>
<Planning
v-if="Object.keys(views).includes('planning')"
:isActive="currentView == 'planning'"
/>
v-if="Object.keys(views).includes('planning')"
:isActive="currentView == 'planning'"
/>
<client-only>
<Transport
v-if="Object.keys(views).includes('transport')"
Expand Down
42 changes: 27 additions & 15 deletions components/Background.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
</template>

<script>
import circle from "../public/assets/circle.svg";
import path1 from "../public/assets/path1.svg";
import path2 from "../public/assets/path2.svg";
import path3 from "../public/assets/path3.svg";
import snow1 from "../public/assets/snow1.svg";
import snow2 from "../public/assets/snow2.svg";
import snow3 from "../public/assets/snow3.svg";
import wave1 from "../public/assets/wave1.svg";
import wave2 from "../public/assets/wave2.svg";
import wave3 from "../public/assets/wave3.svg";
import wave4 from "../public/assets/wave4.svg";

export default {
data() {
return {
Expand All @@ -28,35 +40,35 @@ export default {
decorations: {
circles: [
{
svg: "/assets/circle.svg",
svg: circle,
posStyle: "left: 500px; width: 100px",
transition: "slide-left",
show: false,
class: "full-height",
},
{
svg: "/assets/circle.svg",
svg: circle,
posStyle: "top: 10px; left: 100px; width: 300px",
transition: "slide-top",
show: false,
class: "full-width",
},
{
svg: "/assets/circle.svg",
svg: circle,
posStyle: "right: 100px; width: 200px",
transition: "slide-right",
show: false,
class: "full-height",
},
{
svg: "/assets/circle.svg",
svg: circle,
posStyle: "bottom: 10px; right: 100px; width: 300px",
transition: "slide-bottom",
show: false,
class: "full-width",
},
{
svg: "/assets/circle.svg",
svg: circle,
posStyle: "bottom: 100px; left: 50px; width: 60px",
transition: "slide-bottom",
show: false,
Expand All @@ -65,21 +77,21 @@ export default {
],
lines: [
{
svg: "/assets/path1.svg",
svg: path1,
posStyle: "left: -300px;",
transition: "slide-left",
show: false,
class: "full-height",
},
{
svg: "/assets/path2.svg",
svg: path2,
posStyle: "right: -300px; bottom: -50vh;",
transition: "slide-right",
show: false,
class: "full-height",
},
{
svg: "/assets/path3.svg",
svg: path3,
posStyle: "right: -300px;",
transition: "slide-right",
show: false,
Expand All @@ -88,28 +100,28 @@ export default {
],
waves: [
{
svg: "/assets/wave2.svg",
svg: wave2,
posStyle: "bottom: 0",
transition: "slide-bottom",
show: false,
class: "full-width opaque",
},
{
svg: "/assets/wave1.svg",
svg: wave1,
posStyle: "bottom: 0;",
transition: "slide-bottom",
show: false,
class: "full-width opaque",
},
{
svg: "/assets/wave3.svg",
svg: wave3,
posStyle: "top: 0;",
transition: "slide-top",
show: false,
class: "full-width opaque",
},
{
svg: "/assets/wave4.svg",
svg: wave4,
posStyle: "top: 0;",
transition: "slide-top",
show: false,
Expand All @@ -118,21 +130,21 @@ export default {
],
snow: [
{
svg: "/assets/snow1.svg",
svg: snow1,
posStyle: "height: 40vh; position: absolute; left: 0; top: 0;",
transition: "slide-left",
show: false,
class: "snow",
},
{
svg: "/assets/snow2.svg",
svg: snow2,
posStyle: "right: 0; bottom: 0;",
transition: "slide-right",
show: false,
class: "snow",
},
{
svg: "/assets/snow3.svg",
svg: snow3,
posStyle: "right: 0; top: 0;",
transition: "slide-top",
show: false,
Expand Down
2 changes: 1 addition & 1 deletion components/DateHourHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="header">
<p>{{ currentDate }}</p>
<p>{{ currentTime }}</p>
<img style="width: 150px; margin-left: 150px;" src="/assets/logo_iut_noel.png" />
<img style="width: 150px; margin-left: 150px;" src="/assets/logo_iut_nouvelan.png" />
</div>
</template>

Expand Down
7 changes: 5 additions & 2 deletions components/DiscordCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
</template>

<script>
import qrCode from "@/public/assets/Jeudi.png";
import logoDiscord from "@/public/assets/logo_discord.png";

export default {
data() {
return {
qrCode: "/assets/asso/qrcode.png",
logoDiscord: "/assets/logo_discord.png"
qrCode: qrCode,
logoDiscord: logoDiscord
};
}
};
Expand Down
3 changes: 2 additions & 1 deletion components/PlanningCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
</template>

<script>
import robot from "@/public/assets/robot.png";
export default {
props: {
data: {
Expand All @@ -52,7 +53,7 @@ export default {
},
data() {
return {
noClassLogo: "/assets/robot.png",
noClassLogo: robot,
};
},
methods: {
Expand Down
7 changes: 5 additions & 2 deletions components/TransitionOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
</template>

<script>
import logoIUT from "../public/assets/logo_iut_nouvelan_NOTEXT.png";
import logoGP from "../public/assets/gitpoule.png"

export default {
data() {
return {
active: false,
duration: 3000,
logoIut: "/assets/logo_iut_noel.png",
logoGP: "/assets/gitpoule.png",
logoIut: logoIUT,
logoGP: logoGP,
currentLogo: null
};
},
Expand Down
Loading
Loading