test deploy

This commit is contained in:
Yanis Rigaudeau 2022-09-23 21:43:33 +02:00
parent b5c59cbddb
commit 2172cb8bad
Signed by: yanis
GPG Key ID: 4DD2841DF1C94D83
4 changed files with 38 additions and 2 deletions

16
api/api.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=Api
After=network-online.target
[Service]
Type=simple
Restart=on-failure
User=node
Group=node
WorkingDirectory=/home/node/app
ExecStart=/usr/bin/node /home/node/app/dist/index.js
[Install]
WantedBy=multi-user.target

View File

@ -4,6 +4,6 @@ import express from 'express';
const app = express();
app.use(express.json());
app.use(cors());
app.get('/', (req, res) => res.send('coucou\n'));
app.get('/', (req, res) => res.send('coucou ?\n'));
app.listen(8000, () => console.log('running...'));

20
deploy.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
useradd node -md /home/node -s /usr/sbin/nologin
python3 install.py
python3 build.py
rm -r /var/www/html/*
mv www/public/* /var/www/html
mv api/api.service /etc/systemd/system
systemctl daemon-reload
systemctl enable api
systemctl stop api
mkdir /home/node/app
rm -r /home/node/app/*
mv api/dist /home/node/app
mv api/node_modules /home/node/app
systemctl start api

View File

@ -3,7 +3,7 @@ import App from './App.svelte';
const app = new App({
target: document.body,
props: {
name: 'tout le monde'
name: 'tout tout le monde'
}
});