Skip to content
Merged

Test #71

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
684e135
fix: correct type issues and temporarily remove image option
OlaBekkevold Jan 22, 2026
16a82e0
update migrations and prisma
OlaBekkevold Jan 22, 2026
374fab3
feat: add classes to represent user and loan
OlaBekkevold Jan 23, 2026
ae4116e
feat: add a provider for popup context and small fixes
OlaBekkevold Jan 26, 2026
8b3b4d1
fix: update Playwright test command to specify Firefox project
OlaBekkevold Jan 26, 2026
98873c1
feat: make a production enviroment connecting to the AWS RDS database
OlaBekkevold Jan 27, 2026
0be92c3
feat: add aws workflow and build container
OlaBekkevold Feb 3, 2026
cbac290
fix: correct path to Dockerfile
OlaBekkevold Feb 3, 2026
2cc8c00
fix: small correction
OlaBekkevold Feb 3, 2026
76cd200
test
OlaBekkevold Feb 3, 2026
75526be
fix: update ecs-deploy-action version
OlaBekkevold Feb 3, 2026
5e50b3c
test deployment
OlaBekkevold Feb 3, 2026
92f2a15
test github secrets
OlaBekkevold Feb 5, 2026
e71b316
use aws secrets
OlaBekkevold Feb 6, 2026
9c139df
specifiy correct secret key
OlaBekkevold Feb 6, 2026
871c303
debug secret key
OlaBekkevold Feb 6, 2026
3af43ae
temporarly disable https production requirment
OlaBekkevold Feb 9, 2026
fed65fd
fix: set phone and email inputs to null when empty and make deploymen…
OlaBekkevold Feb 17, 2026
974ea0b
Merge pull request #51 from IMTEL/backend_server
OlaBekkevold Feb 17, 2026
462a6b9
test deployment
OlaBekkevold Feb 18, 2026
7f8ad8c
Test older workflow version
OlaBekkevold Feb 18, 2026
467ad00
feat: loan and borrower editing
OlaBekkevold Feb 20, 2026
469cfd2
feat: improve input and error handling
OlaBekkevold Feb 25, 2026
5ab9c6a
feat: global side view context and early refactoring of sideview
OlaBekkevold Feb 26, 2026
e1246ed
feat: mostly complete refactor of loan edit
OlaBekkevold Feb 26, 2026
b9f7cce
feat: enhance side view components and improve data handling for loan…
OlaBekkevold Feb 27, 2026
4ac6da9
feat: muliti-purpose item list component
OlaBekkevold Mar 3, 2026
fbd58d6
feat: user can change borrowed equipment unit
OlaBekkevold Mar 4, 2026
e0c7c7a
feat: improve loan interface
OlaBekkevold Mar 4, 2026
7f445cc
feat: ui improvements to item list
OlaBekkevold Mar 5, 2026
10456a3
feat: more ui improvements
OlaBekkevold Mar 5, 2026
17bd12c
fix: correct status updates for items
OlaBekkevold Mar 6, 2026
0d47bc1
feat: enhance user deletion process with optimistic UI updates
OlaBekkevold Mar 6, 2026
b49f838
Update AWS workflow to trigger on main branch only
OlaBekkevold Mar 10, 2026
aef6d97
feat: add status management for users and items
OlaBekkevold Mar 10, 2026
3ce08bf
fix: correct types used in testing
OlaBekkevold Mar 10, 2026
ed5dc93
Merge pull request #53 from IMTEL/editingFunc
OlaBekkevold Mar 10, 2026
8e75b96
fix: the editable item list will not try to access the selected unit
OlaBekkevold Mar 10, 2026
b74a013
fix: item list is scrollabe and fits better on smaller screen sizes
OlaBekkevold Mar 11, 2026
811549b
Merge pull request #58 from IMTEL/55-crashes-when-trying-to-open-edit…
OlaBekkevold Mar 11, 2026
2a181f8
feat: first workflow test
OlaBekkevold Mar 11, 2026
ebbad54
fix: change build context
OlaBekkevold Mar 11, 2026
469ce1c
fix: simplify build process
OlaBekkevold Mar 12, 2026
9f0feea
fix: generate prisma
OlaBekkevold Mar 12, 2026
6a65bef
fix: update actions and change to a private package
OlaBekkevold Mar 12, 2026
1e30353
feat: temporary system for initializing the system
OlaBekkevold Mar 12, 2026
379ef5a
feat: add docker image entrypoint for migrating data to db
OlaBekkevold Mar 12, 2026
6d253a0
fix: convert windows line endings to unix
OlaBekkevold Mar 12, 2026
f181b6b
fix: fully make sure entrypoint is in unix format
OlaBekkevold Mar 12, 2026
08cb224
fix: include prisma in the image
OlaBekkevold Mar 12, 2026
fd0969f
fix: optimize prisma usage
OlaBekkevold Mar 12, 2026
46a9fe1
fix: alterantive prisma approach
OlaBekkevold Mar 12, 2026
1dd63cc
fix: pin image prisma version to the project version
OlaBekkevold Mar 12, 2026
30d268e
feat: improve workflow files
OlaBekkevold Mar 12, 2026
0541662
Merge pull request #63 from IMTEL/prodSetup
OlaBekkevold Mar 12, 2026
6f9aeeb
fix: loan status updates correctly in the UI
OlaBekkevold Mar 13, 2026
463ebfb
fix: prevent card attributes from causing line break
OlaBekkevold Mar 16, 2026
6d25c40
fix: old user wont overwrite new user
OlaBekkevold Mar 16, 2026
f584a7a
Merge pull request #67 from IMTEL/ui-bugs
OlaBekkevold Mar 16, 2026
dd520d7
feat: error handling for duplicate names
OlaBekkevold Mar 18, 2026
11bc37c
fix: remove editor configuration files
OlaBekkevold Mar 19, 2026
0cd4c5f
include .idea in gitignore
OlaBekkevold Mar 19, 2026
2f11b7b
Merge pull request #68 from IMTEL/30-more-error-handling-and-security…
OlaBekkevold Mar 19, 2026
3f36cfb
feat: add version number to login page
OlaBekkevold Mar 19, 2026
d843cc5
feat: add readme
OlaBekkevold Mar 20, 2026
b458ef7
Merge pull request #70 from IMTEL/69-prepare-for-first-realease
OlaBekkevold Mar 23, 2026
98d4ef3
feat: build for testing
OlaBekkevold Mar 23, 2026
c026543
fix: determine tag correctly
OlaBekkevold Mar 23, 2026
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
44 changes: 44 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and push docker image to GHCR
on:
workflow_run:
workflows: ["Tests"]
types:
- completed
branches: [main, test]

jobs:
build-and-push:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Log in to container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: olabekkevold
password: ${{ secrets.PAT }}

- name: Determine image tag
id: tag
run: |
if: [ "${{ github.ref }}" == 'refs/heads/main' ]; then
echo "env_tag=latest" >> $GITHUB_OUTPUT
else
echo "env_tag=test" >> $GITHUB_OUTPUT
fi
ghcr.io/olabekkevold/labmanager:${{ github.sha }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./labman
push: true
tags: |
ghcr.io/olabekkevold/labmanager:${{ steps.tag.outputs.env_tag }}
ghcr.io/olabekkevold/labmanager:${{ github.sha }}


6 changes: 3 additions & 3 deletions .github/workflows/main.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Tests
on:
push:
branches: [ main, develop ]
branches: [ main, develop, test ]
pull_request:
branches: [ main, develop ]
branches: [ main, develop, test ]

defaults:
run:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
env:
NODE_ENV: test
HOME: /root
run: npx playwright test
run: npx playwright test --project=firefox
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*
# local env files
.env*.local
.env
.env.production

# vercel
.vercel
Expand Down
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
# LabManager
# VR Lab Manager

The purpose of this project of is to create system for organizing and managing equipment in addition to managing borrowing and returning of equipment.
Initially made for the IMTEL VR Lab at NTNU but it is also usable for other inventories.

## Features

- Add edit and delete equipment
- Manage borrowing and returning of equipment
- Keep track of borrowers and equipment usage
- Manage inventory administrators

## Build and run your own instance

### Requirements

- A computer with Docker installed

### Instructions

1. Build a Docker image using the Dockerfile in ./labman. Run ``docker build -t labman .``
2. Use the provided compose.yaml to run the application and make to make a .env file in the same directory containing the variables reqiored by compose.yaml.
3. In compose.yaml, replace the labman image with name of the image you built in step 1.
4. Start the application by running `docker compose up -d` in the same directory as compose.yaml
5. Open `http://localhost:5000` and login with your own preferred credentials to start using the application

## Develop

### Database
This project uses PostgreSQL as the database, using Prisma as the ORM.

1. Create a PostgreSQL database using your preferred method
2. Make an .env file with the database connection string: `DATABASE_URL=postgres://{username}:{password}@{route}/{database}?schema=public

### Run the application

1. Clone the repository
2. Run `cd labman`
3. Run `npm install`
4. Run `npm prisma generate` to generate the Prisma client
5. Run `npm prisma migrate dev` to run the database migrations
6. Run `npm run dev` to start the development server
7. Open `http://localhost:3000` and login with your own preferred credentials to make a user to access the application


# FAQ

- **Can I use this application for managing other types of inventory?**

Yes, the current name is misleading. The application is perfectly suitable for other things than VR equipment too.

- **I forgot the credentials to my accounts?**

As of now, there is no way to recover lost accounts. If no one has access to create a new account for you, you can directly manipulate the database to delete all users,
which will force the creation of a new account on the next login attempt.

- **Is it safe to store sensitive information in the database?**

Everything is hosted locally with no external connections, and the login passwords are encrypted. Though if you are hosting the application publicly, it is your own responsibility to host it securely.






45 changes: 45 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
services:
labman:
image: ghcr.io/olabekkevold/labmanager:latest
environment:
DATABASE_URL:
ports:
- "5000:3000"
restart: "unless-stopped"
depends_on:
db:
condition: service_healthy

db:
image: postgres:18
restart: always
# set shared memory limit when using docker compose
shm_size: 128mb
# or set shared memory limit when deploy via swarm stack
#volumes:
# - type: tmpfs
# target: /dev/shm
# tmpfs:
# size: 134217728 # 128*2^20 bytes = 128Mb
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 5s
timeout: 5s
retries: 5

adminer:
image: adminer
restart: always
ports:
- 8080:8080


volumes:
postgres_data:
3 changes: 3 additions & 0 deletions labman/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ yarn-error.log*

# env files (can opt-in for committing if needed)
.env
.env.production

# vercel
.vercel
Expand All @@ -42,6 +43,8 @@ next-env.d.ts

/src/generated/prisma

.idea

# Playwright
node_modules/
/test-results/
Expand Down
8 changes: 0 additions & 8 deletions labman/.idea/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions labman/.idea/encodings.xml

This file was deleted.

12 changes: 0 additions & 12 deletions labman/.idea/labman.iml

This file was deleted.

12 changes: 0 additions & 12 deletions labman/.idea/material_theme_project_new.xml

This file was deleted.

8 changes: 0 additions & 8 deletions labman/.idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions labman/.idea/vcs.xml

This file was deleted.

75 changes: 75 additions & 0 deletions labman/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# syntax=docker.io/docker/dockerfile:1

FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi


# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED=1

RUN npx prisma generate

RUN npm run build;

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app


# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED=1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma

COPY --chown=nextjs:nodejs docker-entrypoint.sh .
# Make sure the entrypoint is in Unix format
RUN apk add --no-cache dos2unix && \
dos2unix docker-entrypoint.sh && \
chmod +x docker-entrypoint.sh

RUN npm install -g prisma@6.19.2

USER nextjs

EXPOSE 3000

ENV PORT=3000

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output
ENV HOSTNAME="0.0.0.0"

ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["node", "server.js"]
7 changes: 7 additions & 0 deletions labman/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -e

prisma migrate deploy

exec "$@"
5 changes: 3 additions & 2 deletions labman/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
// Commented out because it is too strict for auto-generated files from other dependencies
/* const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];

export default eslintConfig;
export default eslintConfig; */
1 change: 1 addition & 0 deletions labman/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
output: "standalone",
};

export default nextConfig;
Loading
Loading