nixopus / nixopus/auth

Fresh development setup:auth service fails during migration

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3
Forks
3
Avg merge
2m
Merged PRs (30d)
1

Description

Describe the bug

Following the official development setup from the Nixopus documentation, the nixopus-auth container fails to start because the database migration fails.

The auth container enters a restart loop with the following PostgreSQL error:

ERROR: relation "agent_schedules" does not exist

The failing migration is:

ALTER TABLE "agent_schedules"
ADD COLUMN IF NOT EXISTS "notify_on" text DEFAULT 'smart' NOT NULL;

Steps to reproduce

  1. Fresh clone of the repository.
  2. Copy the environment file:
cp .env.sample .env
  1. Start the development dependencies:
docker compose -f docker-compose-dev.yml up -d
  1. Check the auth container logs:
docker logs -f nixopus-auth

Expected behavior

The auth service should complete database migrations successfully and start normally.


Actual behavior

The auth container repeatedly exits because migration 0045_agent_schedules_notify_on.sql fails with:

ERROR: relation "agent_schedules" does not exist

Investigation

I performed the following checks before opening this issue:

  • Fresh clone of master
  • Followed the official setup documentation
  • Used .env generated from .env.sample
  • Removed all containers, networks and volumes using:
docker compose -f docker-compose-dev.yml down -v
  • Recreated everything from scratch
  • PostgreSQL container becomes healthy
  • Redis container becomes healthy
  • Caddy starts successfully
  • Only nixopus-auth fails during migrations

I also checked the auth repository corresponding to the image revision:

efaa7338ced0d13c8142d751defc657a73d401ff

What I found:

  • drizzle/0045_agent_schedules_notify_on.sql contains:
ALTER TABLE "agent_schedules"
ADD COLUMN IF NOT EXISTS "notify_on" text DEFAULT 'smart' NOT NULL;
  • I searched the migration history for agent_schedules:
grep -R -n "agent_schedules" drizzle

The only result is migration 0045_agent_schedules_notify_on.sql.

  • I also searched all SQL migrations:
grep -R "CREATE TABLE" drizzle

I couldn't find a migration creating agent_schedules.

  • I searched the Drizzle schema as well and couldn't find a schema definition for agent_schedules.

Because of this, I'm unsure whether:

  • there is a missing migration,
  • the migration ordering is incorrect,
  • or there is an additional setup step that I'm missing.

Environment

  • OS: Ubuntu 24.04
  • Docker: 29.1.3
  • Fresh PostgreSQL volume
  • Fresh clone of master

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docker-compose-dev.yml and the auth repository's drizzle migrations, especially 0045_agent_schedules_notify_on.sql. Compare the migration history and Drizzle schema for agent_schedules, then reproduce the failure with a fresh PostgreSQL volume and inspect the nixopus-auth logs. Done means the migration completes and the auth container starts normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, postgresql, typescript
Domain
backend, databases, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.