Skip to content

Admin API and container deletion#104

Merged
runleveldev merged 20 commits intomainfrom
88-uniqueness-testing-for-http-services-externalhostname
Nov 10, 2025
Merged

Admin API and container deletion#104
runleveldev merged 20 commits intomainfrom
88-uniqueness-testing-for-http-services-externalhostname

Conversation

@runleveldev
Copy link
Copy Markdown
Collaborator

@runleveldev runleveldev commented Nov 4, 2025

This pull request introduces major improvements to the data model, authentication middleware, and database schema for the LXC container management application. The changes include a migration to a normalized node model, enhanced uniqueness constraints, new authentication middleware, and the addition of several dependencies for session and flash message support.

Database Model and Migration Overhaul:

  • Added a new Node model and table, normalized container-to-node relationships by replacing the string node field in Container with a foreign key nodeId, and migrated all relevant data and constraints. This includes new migrations for creating the Nodes table, updating Containers, and seeding and converting data appropriately. (create-a-container/migrations/20251104184238-add-node-field-to-containers.js, create-a-container/migrations/20251104193601-create-node.js, create-a-container/migrations/20251104193722-convert-container-node-to-node-id.js, create-a-container/models/node.js, create-a-container/models/container.js) [1] [2] [3] [4] [5] [6] [7]

  • Enforced service uniqueness at the database level by adding unique indexes for HTTP services on externalHostname and for TCP/UDP services on the tuple (type, externalPort). (create-a-container/migrations/20251104160710-add-service-uniqueness-constraints.js, create-a-container/models/service.js) [1] [2]

  • Extended the Node model and table to store Proxmox API token credentials (tokenId, secret). (create-a-container/migrations/20251105145958-add-api-token-to-nodes.js, create-a-container/models/node.js) [1] [2]

Authentication and Session Management:

  • Added new authentication middleware to distinguish between API and browser requests, returning appropriate responses or redirects, and introduced an admin-only middleware. (create-a-container/middlewares/index.js)

  • Added a migration for a persistent Sessions table, supporting session storage for authentication. (create-a-container/migrations/20251105155228-create-sessions-table.js)

API and Documentation Updates:

  • Updated the API documentation to include a new DELETE /containers/:id endpoint for authenticated container deletion with proper authorization and cleanup. (create-a-container/README.md)

  • Documented the new data model with an ER diagram and key constraints in the README. (create-a-container/README.md)

Dependency Additions and Configuration:

  • Added new dependencies for session storage (express-session-sequelize), flash messaging (connect-flash), and HTTP method override (method-override). (create-a-container/package.json, create-a-container/package-lock.json) [1] [2] [3] [4] [5]

  • Disabled SQL logging in the production Sequelize configuration. (create-a-container/config/config.js)

@runleveldev runleveldev linked an issue Nov 4, 2025 that may be closed by this pull request
@runleveldev runleveldev linked an issue Nov 4, 2025 that may be closed by this pull request
@runleveldev runleveldev linked an issue Nov 4, 2025 that may be closed by this pull request
@runleveldev runleveldev linked an issue Nov 4, 2025 that may be closed by this pull request
@runleveldev runleveldev linked an issue Nov 5, 2025 that may be closed by this pull request
…gery

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@runleveldev runleveldev changed the title fix #88: add uniqueness constraints for services Admin API and container deletion Nov 5, 2025
@runleveldev runleveldev marked this pull request as ready for review November 5, 2025 16:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@runleveldev runleveldev requested a review from Copilot November 5, 2025 17:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 12 comments.

Files not reviewed (1)
  • create-a-container/package-lock.json: Language not supported

@runleveldev runleveldev requested a review from Copilot November 5, 2025 20:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 11 comments.

Files not reviewed (1)
  • create-a-container/package-lock.json: Language not supported

Copy link
Copy Markdown
Collaborator

@cmyers-mieweb cmyers-mieweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, we can work on getting this merged next week.

@runleveldev runleveldev merged commit 5734e96 into main Nov 10, 2025
3 checks passed
@runleveldev runleveldev deleted the 88-uniqueness-testing-for-http-services-externalhostname branch November 10, 2025 14:31
runleveldev added a commit that referenced this pull request Nov 10, 2025
runleveldev added a commit that referenced this pull request Nov 10, 2025
fix proxmox username mismatch caused by #104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants