Move SSL to proxy so we don't need sudo for backend
This commit is contained in:
parent
63b522b6d2
commit
f4d4d16b87
3 changed files with 5 additions and 8 deletions
|
@ -3,9 +3,9 @@ import http from 'http';
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
import {Server} from 'socket.io';
|
import {Server} from 'socket.io';
|
||||||
|
|
||||||
// export default new Server({cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});
|
export default new Server({cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});
|
||||||
|
|
||||||
const base = process.env.SSL_KEY && process.env.SSL_CERT && process.env.SSL_CA ? https.createServer({
|
/*const base = process.env.SSL_KEY && process.env.SSL_CERT && process.env.SSL_CA ? https.createServer({
|
||||||
"key": fs.readFileSync(process.env.SSL_KEY),
|
"key": fs.readFileSync(process.env.SSL_KEY),
|
||||||
"cert": fs.readFileSync(process.env.SSL_CERT),
|
"cert": fs.readFileSync(process.env.SSL_CERT),
|
||||||
"ca": fs.readFileSync(process.env.SSL_CA)
|
"ca": fs.readFileSync(process.env.SSL_CA)
|
||||||
|
@ -14,4 +14,4 @@ base.listen(+process.env.PORT!, '0.0.0.0', () => {
|
||||||
console.log(`Listening on port ${process.env.PORT}`);
|
console.log(`Listening on port ${process.env.PORT}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default new Server(base, {cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});
|
export default new Server(base, {cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});*/
|
||||||
|
|
5
env
5
env
|
@ -1,6 +1,3 @@
|
||||||
export NEXT_PUBLIC_BACK_HOST='https://server.exozy.me'
|
export NEXT_PUBLIC_BACK_HOST='https://server.exozy.me'
|
||||||
export ORIGIN="*"
|
export ORIGIN="*"
|
||||||
export PORT=6001
|
export PORT=6000
|
||||||
export SSL_KEY=/etc/letsencrypt/live/exozy.me/privkey.pem
|
|
||||||
export SSL_CERT=/etc/letsencrypt/live/exozy.me/cert.pem
|
|
||||||
export SSL_CA=/etc/letsencrypt/live/exozy.me/chain.pem
|
|
||||||
|
|
2
run
2
run
|
@ -2,4 +2,4 @@
|
||||||
source ./env
|
source ./env
|
||||||
./build
|
./build
|
||||||
cd front
|
cd front
|
||||||
npm run start -- -p 5000 | sudo -E node ../back/dist/index.js # sudo hack to read SSL files
|
npm run start -- -p 5000 | node ../back/dist/index.js
|
||||||
|
|
Loading…
Reference in a new issue