Skip to content

Conversation

@xar
Copy link
Owner

@xar xar commented Jun 28, 2025

Fixes the pgforge service autostart issue where enabled services wouldn't start after system restart.

Changes

  • Fixed systemd service file generation to use Type=notify instead of Type=forking
  • Added missing PostgreSQL options (socket directory, port)
  • Added proper ExecStop command and timeouts
  • Updated CLI commands to use service-aware methods
  • Made restart command service-aware

Testing

  1. Enable service: pgforge enable-service <instance>
  2. Check status: pgforge service-status <instance>
  3. Restart system to verify autostart works

Fixes #52

Generated with Claude Code

- Fix service file generation in ServiceManager:
  * Change Type=forking to Type=notify for better PostgreSQL integration
  * Add missing PostgreSQL options (-k socket directory, -p port)
  * Add proper ExecStop command for graceful shutdown
  * Increase timeouts from 0 to 120 seconds for proper startup/shutdown

- Fix CLI commands to use service-aware methods:
  * start command now uses startInstanceWithService()
  * stop command now uses stopInstanceWithService() 
  * restart command updated to use service-aware methods

- Update restartInstance() to be service-aware
  * Now uses service-aware stop/start methods for consistency

These changes ensure PostgreSQL instances with enabled services:
- Properly autostart after system restart via systemd
- Use consistent service management for manual operations
- Have proper systemd service configuration

Fixes #52

Co-authored-by: Samuel <xar@users.noreply.github.com>
@xar xar merged commit 645914a into main Jun 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pgforge service autostart doesn't work

2 participants