Prepared for Garden
This commit is contained in:
parent
96ebe71cb6
commit
4bfe7bebc2
9 changed files with 45 additions and 67 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,9 +1,9 @@
|
||||||
FROM node:latest
|
FROM node:16
|
||||||
RUN apt-get update && apt-get upgrade -y
|
WORKDIR /dunemask/net/khufu
|
||||||
WORKDIR /dunestorm/khufu
|
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
RUN npm i --only=prod
|
RUN npm i
|
||||||
|
COPY public public
|
||||||
|
COPY src src
|
||||||
|
RUN npm run build:react
|
||||||
COPY server server
|
COPY server server
|
||||||
COPY build build
|
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
EXPOSE 52026
|
|
||||||
|
|
16
dist/predeploy-vanilla.sh
vendored
16
dist/predeploy-vanilla.sh
vendored
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo "Creating vanilla predeploy!"
|
|
||||||
# Set path correclty
|
|
||||||
if [[ $PWD == *"dist" ]];
|
|
||||||
then cd ..
|
|
||||||
fi
|
|
||||||
# If .env exists, ignore it
|
|
||||||
if [[ ! -f ".env" ]];then
|
|
||||||
echo "Building vanilla env file!"
|
|
||||||
echo "PORT=52026
|
|
||||||
NUBIAN_INTERNAL_URL=\${NUBIAN_INTERNAL_URL}
|
|
||||||
REACT_APP_CAIRO_PUBLIC_URL=\${CAIRO_PUBLIC_URL}" >> .env
|
|
||||||
fi
|
|
||||||
# Install node dependencies
|
|
||||||
echo "Installing node depencencies!"
|
|
||||||
npm i
|
|
|
@ -1,15 +0,0 @@
|
||||||
version: "3"
|
|
||||||
services:
|
|
||||||
khufu.dunestorm.net:
|
|
||||||
image: khufu.dunestorm.net
|
|
||||||
build: .
|
|
||||||
ports:
|
|
||||||
- "52026:52026"
|
|
||||||
networks:
|
|
||||||
- dunestorm_dev
|
|
||||||
environment:
|
|
||||||
- CAIRO_PUBLIC_URL=${CAIRO_PUBLIC_URL}
|
|
||||||
- NUBIAN_INTERNAL_URL=${NUBIAN_INTERNAL_URL}
|
|
||||||
networks:
|
|
||||||
dunestorm_dev:
|
|
||||||
external: true
|
|
18
package.json
18
package.json
|
@ -7,9 +7,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"http-proxy-middleware": "^2.0.1"
|
"http-proxy-middleware": "^2.0.1",
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
||||||
"@fortawesome/free-brands-svg-icons": "^5.15.4",
|
"@fortawesome/free-brands-svg-icons": "^5.15.4",
|
||||||
"@fortawesome/free-regular-svg-icons": "^5.15.4",
|
"@fortawesome/free-regular-svg-icons": "^5.15.4",
|
||||||
|
@ -21,16 +19,20 @@
|
||||||
"react-dropzone": "^11.3.4",
|
"react-dropzone": "^11.3.4",
|
||||||
"react-fontawesome": "^1.7.1",
|
"react-fontawesome": "^1.7.1",
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": "^5.2.0",
|
||||||
"react-scripts": "^4.0.3",
|
|
||||||
"react-toastify": "^7.0.4",
|
"react-toastify": "^7.0.4",
|
||||||
"sass": "^1.37.5"
|
"sass": "^1.37.5"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"react-scripts": "^4.0.3",
|
||||||
|
"nodemon": "^2.0.14"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server/index.js",
|
"start": "node server/index.js",
|
||||||
"start:dev": "nodemon server/index.js",
|
"start:dev": "nodemon server/index.js",
|
||||||
"start:react": "react-scripts start",
|
"start:react": "react-scripts start",
|
||||||
"build:react": "react-scripts build",
|
"build:react": "react-scripts build",
|
||||||
"build:all": "npm run build:react && docker-compose build"
|
"start:garden": "KHUFU_DEV_PORT=52035 node server/index.js",
|
||||||
|
"start:garden:dev": "nodemon server/index.js & CI=true PORT=52035 CAIRO_PROXY_URL=http://localhost:52002 NUBIAN_PROXY_URL=http://localhost:52002 react-scripts start"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
@ -43,11 +45,5 @@
|
||||||
"last 1 firefox version",
|
"last 1 firefox version",
|
||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"nodemonConfig": {
|
|
||||||
"env": {
|
|
||||||
"CAIRO_PUBLIC_URL": "http://localhost:52000",
|
|
||||||
"NUBIAN_INTERNAL_URL": "http://localhost:52001"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const { createProxyMiddleware: proxy } = require("http-proxy-middleware");
|
const { createProxyMiddleware: proxy } = require("http-proxy-middleware");
|
||||||
const port = process.env.PORT ?? 52026;
|
const port = process.env.KHUFU_DEV_PORT ?? 52002;
|
||||||
const cairoUrl = process.env.CAIRO_PUBLIC_URL;
|
const { REACT_APP_CAIRO_URL, REACT_APP_NUBIAN_URL } = process.env;
|
||||||
const nubianUrl = process.env.NUBIAN_INTERNAL_URL;
|
const cairoProxyOpt = {
|
||||||
|
target: REACT_APP_CAIRO_URL,
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { "^/api/cairo": "/api" },
|
||||||
|
};
|
||||||
|
const nubianProxyOpt = {
|
||||||
|
target: REACT_APP_NUBIAN_URL,
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { "^/api/nubian": "/api" },
|
||||||
|
};
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use("/", express.static("build"));
|
app.use("/", express.static("build"));
|
||||||
app.use("/cairo", proxy({ target: cairoUrl, changeOrigin: true }));
|
app.use("/api/cairo", proxy(cairoProxyOpt));
|
||||||
app.use("/nubian", proxy({ target: nubianUrl, changeOrigin: true }));
|
app.use("/api/nubian", proxy(nubianProxyOpt));
|
||||||
app.listen(port, () => console.log(`🌴 Nile server started on ${port}! 🌴`));
|
app.get("/healthcheck", (req, res) => res.sendStatus(200));
|
||||||
|
app.get("/alive", (req, res) => res.sendStatus(200));
|
||||||
|
app.listen(port, () => console.log(`🌴 Nile px server started on ${port}! 🌴`));
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Stash extends React.Component {
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.response && error.response.status === 401)
|
if (error.response && error.response.status === 401)
|
||||||
return window.location.replace(
|
return window.location.replace(
|
||||||
`${process.env.REACT_APP_CAIRO_PUBLIC_URL}${api.cairo.urls.login}?redirectUri=${window.location.href}`
|
`${process.env.REACT_APP_CAIRO_URL}/authenticate?redirectUri=${window.location.href}`
|
||||||
);
|
);
|
||||||
console.error("Auth server not up/configured properly!");
|
console.error("Auth server not up/configured properly!");
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,17 +2,17 @@
|
||||||
"api": {
|
"api": {
|
||||||
"cairo": {
|
"cairo": {
|
||||||
"urls": {
|
"urls": {
|
||||||
"verify": "/cairo/api/user/data",
|
"verify": "api/cairo/user/info",
|
||||||
"login": "/cairo/login"
|
"login": "cairo/login"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nubian": {
|
"nubian": {
|
||||||
"urls": {
|
"urls": {
|
||||||
"files": "/nubian/api/stash/files",
|
"files": "api/nubian/stash/files",
|
||||||
"upload": "/nubian/api/stash/upload",
|
"upload": "api/nubian/stash/upload",
|
||||||
"download": "/nubian/api/stash/download",
|
"download": "api/nubian/stash/download",
|
||||||
"delete": "/nubian/api/stash/delete",
|
"delete": "api/nubian/stash/delete",
|
||||||
"public": "/nubian/api/stash/public"
|
"public": "api/nubian/stash/public"
|
||||||
},
|
},
|
||||||
"misc": {
|
"misc": {
|
||||||
"uploadField": "user-selected-file"
|
"uploadField": "user-selected-file"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const { createProxyMiddleware } = require("http-proxy-middleware");
|
const { createProxyMiddleware } = require("http-proxy-middleware");
|
||||||
const cairoUrl = process.env.REACT_APP_CAIRO_PUBLIC_URL;
|
const cairoUrl = process.env.CAIRO_PROXY_URL ?? "http://localhost:52002";
|
||||||
const nubianUrl = process.env.NUBIAN_INTERNAL_URL;
|
const nubianUrl = process.env.NUBIAN_PROXY_URL ?? "http://localhost:52002";
|
||||||
module.exports = (app) => {
|
module.exports = (app) => {
|
||||||
// Cairo Proxy
|
// Cairo Proxy
|
||||||
app.use("/cairo", createProxyMiddleware({ target: cairoUrl }));
|
app.use("/api/cairo", createProxyMiddleware({ target: cairoUrl }));
|
||||||
app.use("/nubian", createProxyMiddleware({ target: nubianUrl }));
|
app.use("/api/nubian", createProxyMiddleware({ target: nubianUrl }));
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,7 +101,9 @@ export default class StashContextMenu extends React.Component {
|
||||||
const selectedBoxes = this.props.getSelectedBoxes();
|
const selectedBoxes = this.props.getSelectedBoxes();
|
||||||
if (selectedBoxes.length !== 1)
|
if (selectedBoxes.length !== 1)
|
||||||
return toast.error("Only one file can be selected!");
|
return toast.error("Only one file can be selected!");
|
||||||
const url = `${window.location.origin}${process.env.PUBLIC_URL}${downloadUrl}?target=${selectedBoxes[0]}`;
|
if (window.location.protocol !== "https:")
|
||||||
|
return toast.error("Cannot clipboard without https!");
|
||||||
|
const url = `${window.location.origin}/${downloadUrl}?target=${selectedBoxes[0]}`;
|
||||||
navigator.clipboard.writeText(url);
|
navigator.clipboard.writeText(url);
|
||||||
toast.success("Link successfully copied!");
|
toast.success("Link successfully copied!");
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue