Fixed lots of issues

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2023-01-20 16:08:32 -08:00
parent 737b79eb5d
commit ccdfd2513f
3 changed files with 40 additions and 3 deletions

View File

@ -29,14 +29,20 @@ FROM base AS production
RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
git
# Not sure if the root is actually used for anything...
WORKDIR /website
COPY /package.json /website/
RUN npm install
COPY /.babelrc /*.html /*.js /website/
COPY /src /website/src
COPY /frontend /website/frontend
RUN npm run build
# Polymer frontend app built using bower
WORKDIR /website/frontend
COPY /frontend /website/frontend
RUN npx bower install
# 'identities' frontend built using react
WORKDIR /website/client
COPY /client/package.json /website/client/
RUN npm install
@ -96,7 +102,7 @@ COPY /ketrface /website/ketrface
FROM runtime AS website
RUN echo "Building PRODUCTION"
COPY /server/production.location /etc/nginx/snippets/active.location
COPY /frontend /website/frontend
COPY --from=production /frontend /website/frontend
COPY --from=production /website/dist /website/dist
COPY --from=production /website/*.html /website/
COPY --from=production /website/client/build /website/client/build

View File

@ -1,4 +1,8 @@
#!/bin/bash
fail() {
echo "$*" >&2
exit -1
}
if [[ "${TARGET_PORT}" != "" ]]; then
sed -i -e "s,8123,${TARGET_PORT},g" /etc/nginx/sites-enabled/default
@ -26,6 +30,24 @@ if [[ -z "${DEVELOPMENT}" ]]; then
{ while true; do npm start ; sleep 3 ; done ; }
else
echo "Running in DEVELOPMENT mode."
if [[ -d /website/frontend/bower_components ]]; then
cd /website/frontend
npm install &&
npx bower install || fail "Unable to install frontend"
fi
if [[ -d /website/client/node_modules ]]; then
cd /website/client
npm install || fail "Unable to install client"
fi
if [[ -d /website/node_modules ]]; then
cd /website
npm install || fail "Unable to install website"
fi
if [[ -d /website/server/node_modules ]]; then
cd /website/server
npm install || fail "Unable to install server"
fi
cd /website/server
{ while true; do npm start ; sleep 3 ; done ; } &
cd /website/client

View File

@ -91,8 +91,17 @@ app.use(function(req, res, next){
});
});
const dbPath = { ...config.get("sessions.db") };
let configPath = process.env.NODE_CONFIG_DIR;
if (configPath) {
configPath = configPath.replace(/config/, '');
} else {
configPath = './'
}
dbPath = `${configPath}${dbPath}`;
app.use(session({
store: new SQLiteStore({ db: config.get("sessions.db") }),
store: new SQLiteStore({ db: dbPath }),
secret: config.get("sessions.store-secret"),
cookie: { maxAge: 7 * 24 * 60 * 60 * 1000 }, // 1 week
saveUninitialized: false,