Merge branch 'ep/Nov5/PostgresAndGardenMigration' into 'master'
Prepared for Garden See merge request Dunemask/khufu!2
This commit is contained in:
commit
690ce1ef7b
9 changed files with 45 additions and 67 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,9 +1,9 @@
|
|||
FROM node:latest
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
WORKDIR /dunestorm/khufu
|
||||
FROM node:16
|
||||
WORKDIR /dunemask/net/khufu
|
||||
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 build build
|
||||
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": {
|
||||
"axios": "^0.21.1",
|
||||
"express": "^4.17.1",
|
||||
"http-proxy-middleware": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"http-proxy-middleware": "^2.0.1",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.4",
|
||||
"@fortawesome/free-regular-svg-icons": "^5.15.4",
|
||||
|
@ -21,16 +19,20 @@
|
|||
"react-dropzone": "^11.3.4",
|
||||
"react-fontawesome": "^1.7.1",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "^4.0.3",
|
||||
"react-toastify": "^7.0.4",
|
||||
"sass": "^1.37.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-scripts": "^4.0.3",
|
||||
"nodemon": "^2.0.14"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node server/index.js",
|
||||
"start:dev": "nodemon server/index.js",
|
||||
"start:react": "react-scripts start",
|
||||
"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": {
|
||||
"production": [
|
||||
|
@ -43,11 +45,5 @@
|
|||
"last 1 firefox 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 { createProxyMiddleware: proxy } = require("http-proxy-middleware");
|
||||
const port = process.env.PORT ?? 52026;
|
||||
const cairoUrl = process.env.CAIRO_PUBLIC_URL;
|
||||
const nubianUrl = process.env.NUBIAN_INTERNAL_URL;
|
||||
const port = process.env.KHUFU_DEV_PORT ?? 52002;
|
||||
const { REACT_APP_CAIRO_URL, REACT_APP_NUBIAN_URL } = process.env;
|
||||
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();
|
||||
app.use("/", express.static("build"));
|
||||
app.use("/cairo", proxy({ target: cairoUrl, changeOrigin: true }));
|
||||
app.use("/nubian", proxy({ target: nubianUrl, changeOrigin: true }));
|
||||
app.listen(port, () => console.log(`🌴 Nile server started on ${port}! 🌴`));
|
||||
app.use("/api/cairo", proxy(cairoProxyOpt));
|
||||
app.use("/api/nubian", proxy(nubianProxyOpt));
|
||||
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) => {
|
||||
if (error.response && error.response.status === 401)
|
||||
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!");
|
||||
});
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
"api": {
|
||||
"cairo": {
|
||||
"urls": {
|
||||
"verify": "/cairo/api/user/data",
|
||||
"login": "/cairo/login"
|
||||
"verify": "api/cairo/user/info",
|
||||
"login": "cairo/login"
|
||||
}
|
||||
},
|
||||
"nubian": {
|
||||
"urls": {
|
||||
"files": "/nubian/api/stash/files",
|
||||
"upload": "/nubian/api/stash/upload",
|
||||
"download": "/nubian/api/stash/download",
|
||||
"delete": "/nubian/api/stash/delete",
|
||||
"public": "/nubian/api/stash/public"
|
||||
"files": "api/nubian/stash/files",
|
||||
"upload": "api/nubian/stash/upload",
|
||||
"download": "api/nubian/stash/download",
|
||||
"delete": "api/nubian/stash/delete",
|
||||
"public": "api/nubian/stash/public"
|
||||
},
|
||||
"misc": {
|
||||
"uploadField": "user-selected-file"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const { createProxyMiddleware } = require("http-proxy-middleware");
|
||||
const cairoUrl = process.env.REACT_APP_CAIRO_PUBLIC_URL;
|
||||
const nubianUrl = process.env.NUBIAN_INTERNAL_URL;
|
||||
const cairoUrl = process.env.CAIRO_PROXY_URL ?? "http://localhost:52002";
|
||||
const nubianUrl = process.env.NUBIAN_PROXY_URL ?? "http://localhost:52002";
|
||||
module.exports = (app) => {
|
||||
// Cairo Proxy
|
||||
app.use("/cairo", createProxyMiddleware({ target: cairoUrl }));
|
||||
app.use("/nubian", createProxyMiddleware({ target: nubianUrl }));
|
||||
app.use("/api/cairo", createProxyMiddleware({ target: cairoUrl }));
|
||||
app.use("/api/nubian", createProxyMiddleware({ target: nubianUrl }));
|
||||
};
|
||||
|
|
|
@ -101,7 +101,9 @@ export default class StashContextMenu extends React.Component {
|
|||
const selectedBoxes = this.props.getSelectedBoxes();
|
||||
if (selectedBoxes.length !== 1)
|
||||
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);
|
||||
toast.success("Link successfully copied!");
|
||||
}
|
||||
|
|
Reference in a new issue