Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions crates/opsml_server/opsml_ui/src/lib/server/auth/validateToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,24 @@ export async function setTokenInCookies(

cookies.set("jwt_token", token, {
httpOnly: true,
secure: true,
secure:
process.env.APP_ENV === "production" ||
process.env.FORCE_HTTPS === "true",
sameSite: "lax",
domain: options?.domain ?? "localhost",
expires: expirationDate,
path: options?.path ?? "/",
maxAge: 7 * 24 * 60 * 60,
});
}

export async function setUsernameInCookies(
cookies: Cookies,
username: string
): Promise<void> {
export function setUsernameInCookies(cookies: Cookies, username: string): void {
cookies.set("username", username, {
httpOnly: false,
secure: true,
httpOnly: false, // Client needs to read this for UI state
secure:
process.env.APP_ENV === "production" ||
process.env.FORCE_HTTPS === "true",
sameSite: "lax",
domain: "localhost",
path: "/",
maxAge: 7 * 24 * 60 * 60, // 7 days in seconds
});
}

Expand Down
2 changes: 1 addition & 1 deletion crates/opsml_server/opsml_ui/src/lib/server/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pino from "pino";

const logLevel = process.env.LOG_LEVEL || "info";
export const logger = pino({ level: logLevel });
export const logger = pino({ level: logLevel.toLowerCase() });
2 changes: 2 additions & 0 deletions docker/official/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ RUN apt-get update --no-install-recommends \

ARG OPSML_PORT=8000
ARG OPSML_SERVER_BINARY
ARG APP_ENV=staging

# Set environment variables
ENV OPSML_PORT=${OPSML_PORT}
ENV APP_ENV=${APP_ENV}

# Copy built UI, server binary, NGINX config, and entrypoint script
COPY --chown=opsml:opsml ${OPSML_SERVER_BINARY}/ui/node_modules /app/ui/node_modules/
Expand Down
5 changes: 5 additions & 0 deletions docker/official/extras/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ exec 2>&1

export OPSML_PORT=${OPSML_PORT:-8000}
export OPSML_SERVER_PORT=${OPSML_SERVER_PORT:-8080}
export APP_ENV=${APP_ENV:-staging}

if ! [[ "$OPSML_PORT" =~ ^[0-9]+$ ]]; then
echo "$(date): ERROR: OPSML_PORT must be numeric, got: $OPSML_PORT"
exit 1
fi


# PID tracking
RUST_API_PID=""
SVELTEKIT_PID=""
Expand Down Expand Up @@ -82,6 +84,9 @@ wait_for_service() {
return 1
}

# echo app env
echo "$(date): Starting OpsML in APP_ENV=${APP_ENV}"

# update nginx template
echo "$(date): Configuring NGINX..."
if ! envsubst '${OPSML_PORT}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf; then
Expand Down
8 changes: 8 additions & 0 deletions docker/official/extras/nginx/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;

proxy_set_header Cookie $http_cookie;
proxy_pass_header Set-Cookie;

proxy_read_timeout 86400;
proxy_send_timeout 86400;
}
Expand All @@ -96,6 +100,8 @@ http {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Cookie $http_cookie;
proxy_pass_header Set-Cookie;
access_log off; # Don't log health checks
}

Expand All @@ -109,6 +115,8 @@ http {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Cookie $http_cookie;
proxy_pass_header Set-Cookie;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
Expand Down
2 changes: 2 additions & 0 deletions docker/official/rocky/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ RUN microdnf update -y \

ARG OPSML_PORT=8000
ARG OPSML_SERVER_BINARY
ARG APP_ENV=staging

# Set environment variables
ENV OPSML_PORT=${OPSML_PORT}
ENV APP_ENV=${APP_ENV}

# Copy built UI, server binary, NGINX config, and entrypoint script
COPY --chown=opsml:opsml ${OPSML_SERVER_BINARY}/ui/node_modules /app/ui/node_modules/
Expand Down
2 changes: 2 additions & 0 deletions docker/official/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ RUN apt-get update --no-install-recommends \

ARG OPSML_PORT=8000
ARG OPSML_SERVER_BINARY
ARG APP_ENV=staging

# Set environment variables
ENV OPSML_PORT=${OPSML_PORT}
ENV APP_ENV=${APP_ENV}

# Copy built UI, server binary, NGINX config, and entrypoint script
COPY --chown=opsml:opsml ${OPSML_SERVER_BINARY}/ui/node_modules /app/ui/node_modules/
Expand Down