This pull request updates the startup script in `apps/startup-scripts/src/starter` to improve handling of interactive and non-interactive modes, particularly when running under different session managers.
### Improvements to interactive and non-interactive mode handling:
* Updated the condition to check if the application should run interactively by combining `AC_LAUNCHED_BY_PM2` and `AC_DISABLE_INTERACTIVE` environment variables. This ensures more accurate handling of interactive mode.
Fixes: https://github.com/azerothcore/azerothcore-wotlk/issues/22507
New feature to manage service restart policies and refactors crash logging paths for better flexibility and clarity. The most significant changes include adding support for configurable restart policies (`on-failure` and `always`), updating documentation to reflect these changes, and improving crash path handling in multiple scripts.
This pull request introduces several enhancements and fixes to the startup scripts for AzerothCore, focusing on improving service management, interactive mode handling, and script execution. The most important changes include adding support for non-interactive mode, enhancing systemd integration, and refactoring the starter script to handle binary paths and files more robustly.
### Enhancements to Service Management:
* **Non-Interactive Mode:** Added `AC_DISABLE_INTERACTIVE` environment variable to disable interactive prompts for services running without session managers (e.g., systemd/pm2). This prevents hanging during non-interactive execution. (`apps/startup-scripts/src/run-engine`, `apps/startup-scripts/src/service-manager.sh`) [[1]](diffhunk://#diff-1792abab64da981c71221890876ce832aab405f670f320f75b73b8788b1a4174R336-R349) [[2]](diffhunk://#diff-31edfed7f73d0647a5fc96ce74c249e025e884cd1fe06621cb78eb4a381464f9R724-R727)
* **Enhanced Systemd Integration:** Services using session managers like tmux/screen are automatically configured with `Type=forking` and appropriate `ExecStop` commands to terminate sessions gracefully. (`apps/startup-scripts/src/service-manager.sh`) [[1]](diffhunk://#diff-31edfed7f73d0647a5fc96ce74c249e025e884cd1fe06621cb78eb4a381464f9R401-R425) [[2]](diffhunk://#diff-31edfed7f73d0647a5fc96ce74c249e025e884cd1fe06621cb78eb4a381464f9R567-R578)
### Improvements to Script Execution:
* **Starter Script Refactor:** Updated the starter script to require both binary path and file name as parameters, improving clarity and error handling. (`apps/startup-scripts/src/starter`) [[1]](diffhunk://#diff-e92f132163ec1e49dc625eac9107c6841ae14e416aa35adec787dca5031dc631L6-R16) [[2]](diffhunk://#diff-e92f132163ec1e49dc625eac9107c6841ae14e416aa35adec787dca5031dc631L26-R44)
* **Temporary GDB File Management:** Enhanced handling of temporary GDB configuration files, ensuring proper cleanup after execution. (`apps/startup-scripts/src/starter`) [[1]](diffhunk://#diff-e92f132163ec1e49dc625eac9107c6841ae14e416aa35adec787dca5031dc631R68-R70) [[2]](diffhunk://#diff-e92f132163ec1e49dc625eac9107c6841ae14e416aa35adec787dca5031dc631R92-R141)
### Updates to Tests:
* **Test Adjustments:** Modified test cases to reflect the updated starter script parameter requirements and error messages. (`apps/startup-scripts/test/test_startup_scripts.bats`) [[1]](diffhunk://#diff-febbaeb294e50bdba0511ecad5d44b0c3f11ae92c79dd19dbd5f61d41a654278L26-R26) [[2]](diffhunk://#diff-febbaeb294e50bdba0511ecad5d44b0c3f11ae92c79dd19dbd5f61d41a654278L41-R49)
* closes https://github.com/azerothcore/azerothcore-wotlk/issues/4343
This pull request replaces the PowerShell implementation of the AzerothCore database export and squash tools with Bash scripts, streamlining the process and improving compatibility. It also updates the documentation to reflect these changes. The most important changes include the creation of new Bash scripts for exporting databases, squashing databases, and updating versions, as well as the removal of the previous PowerShell script and its associated documentation.
### Script Replacement and Enhancements:
* [`apps/DatabaseSquash/DatabaseExporter/DatabaseExporter.sh`](diffhunk://#diff-af0bd252ac095aaad91b842c75b60a689792e6dc9ce88f5e2e4b6f68acf84dcaR1-R69): Introduced a Bash script to replace the PowerShell implementation for exporting database tables, with added features such as formatted SQL output and dynamic directory creation.
* [`apps/DatabaseSquash/DatabaseSquash.sh`](diffhunk://#diff-79ff4f749c045a7d91e9b43aefb5d6fbebdc5fdfb430fbcba329e4d96d71a4fbR1-R52): Added a Bash script to automate the database squash process, integrating the version updater and database exporter tools.
* [`apps/DatabaseSquash/VersionUpdater/VersionUpdater.sh`](diffhunk://#diff-3abc69c645cb80aff30824739e317c9e847e743eeab15ab4825951d10179b265R1-R84): Created a Bash script for automatically updating the version in `acore.json` and generating SQL update files with proper versioning.
### Documentation Updates:
* [`apps/DatabaseSquash/DatabaseExporter/databaseexporter.md`](diffhunk://#diff-b2b291286f2b900a022474f00754ebfe78410780c010d46752335a372d688aefR1-R16): Rewritten documentation to reflect the usage of the new Bash script for database exporting.
* [`apps/DatabaseSquash/VersionUpdater/versionupdater.md`](diffhunk://#diff-f12e21f8a404957c90d9120cf9df0724ff27a7efdb5de0798d974079cfe8adadR1-R10): Added documentation for the new version updater tool, explaining its functionality and usage.
* [`apps/DatabaseSquash/databasesquash.md`](diffhunk://#diff-4a559f6e7404b529714bac65ad22744feb7b9f88343864a20e0a46974233767eR1-R11): Documented the overall database squash tool, detailing its integration of the version updater and database exporter scripts.
### Removal of Legacy Code:
* [`apps/DatabaseExporter/DatabaseExporter.ps1`](diffhunk://#diff-2b4e49f704d88a372b5160c7278839668c81dbecaf52a4edd327873e30b9ae70L1-L234): Removed the PowerShell script for database exporting, along with its associated functionality and settings.
* [`apps/DatabaseExporter/databaseexporter.md`](diffhunk://#diff-0618d62def0d611be6e0d4fc524df6f702f493cb87870d9382402aaf52f484e8L1-L85): Deleted outdated documentation for the PowerShell-based database exporter tool.
* feat(CI/Codestyle): check for braces after if/else statements
* right need to edit a cpp file to trigger cpp check
* Revert "right need to edit a cpp file to trigger cpp check"
This reverts commit 2e34d8c52f35216549107a3476e79e79ea2ae077.
* fix codestyle in cpp
* Update oculus.cpp
* Update codestyle.py
* Update codestyle.py
* Update codestyle.py
* Update codestyle.py
* fix(CI/MacOS): Fix MacOS CI dependency installation.
* Try to use macos 14 version
* Remove brew cleanup and z3 dependency
* Adjust readline lib discovery
* Update macos supported version in SECURITY.md
* Added modules to dbimport so sql cab accessed by loader
* updated dbimport tools config option to enable module sql to be updated and populated
* Updated casting around GetOption and changed default to all
* initial version
* port most current checks
* allow to specify for each checks the exclude files
* Update _ci-codestyle.py
* fix trailing whitespace check and the error_handler logic
* optimize the script to parse all files only one time
* restore the error handling after that all checks are passed
* fix double blank lines at the end of the file
* improve outputs and the codestyle
* .
* update github workflow to the new script
*drop the old ci-codestyle
*move and rename the python script
* use getcwd instead abspath to define src_directory where the script is launch
* test for github workflow
* few cleanup
* fix the logic with the result output
* remove GetTypeId from the output result
* restore GetTypeId() check
* fix reviews
* remove GetTypeId check for gameobjects
*not currently fixed in the core
* fix type hint for file parameters
* remove the test file
* fix(CI/MacOS): Try to fix macOS mysql setup.
* Update ci-compile.sh
* More debug code
* Mooooore debug
* Moooooorreee
* Moooooooooooorereerererer
* m o r e debug
* more debug
* more
* More debug
* 9.0.1.reinstall??? we already had mysql?
* debug
* Debug
* Are we happy now?
* No? And what about now?!
* Adn now?
* Yes, we are happy 😎
* chore(CI): Make some changes. Less CI's maybe better...
* pendingsql
* FORK TEST - TO BE REVERTED
* changes
* test
* fix
* Revert "FORK TEST - TO BE REVERTED"
This reverts commit 875bc281c5a355cce2ddd8015484e256dbc185cf.
* rename workflow
* rename workflow
* rename workflow
* rename workflow
* I argue windows don't need dry runs
* maybe mac wants to be alive. who knows. When do we drop mac support really...?
* refactor(Docker): remove prod containers
* workflows: use buildx
* properly set tags
* comment in Dockerfile
* set docker build context
* minor CI changes
* CI: docker build args shouldnt have quotes
* CI: using matrix and caching is too much work
* CI: I hate yaml
* CI: It was a typo
* CI: extra build removed
* CI: appease the linter
* fixup! CI: appease the linter
* fixup! CI: appease the linter
* apps: docker: remove extraneous files
* remove deno as a dependency
* use the ACORE_VERSION env var
* I forgot client-data
* accidentally removed too much
* docker-cmd: extraneous parallel flag
* typo
* remove docker image prune -af
the `docker image prune` removes the containers we just build.
* fetch everything in the beginning
* refactor(DB/Misc): Improve loading time
* NOTE: Running these SQL files can take several minutes (up to 30minutes depending on your system!)
* This will improve loading time over 50%
* comment out error on editing broadcast_text tables
* Update data/sql/updates/pending_db_world/rev_1679045387127819800.sql
## Changes Proposed:
- This properly moves things from `DOCKER_ETC_FOLDER` to `confDir`
- originally broken with
888a718cf3
## Issues Addressed:
- Should hopefully close
https://github.com/azerothcore/acore-docker/issues/12
## SOURCE:
## Tests Performed:
- I'm not exactly aware of the testing procedure for this, as I don't
use acore-docker
- That said, the previous behavior has been replicated:
2420d19e54/apps/compiler/includes/functions.sh (L148-L150)
- Open to suggestions
## How to Test the Changes:
1. Open to Suggestions
## Known Issues and TODO List:
- Test properly
## How to Test AzerothCore PRs
When a PR is ready to be tested, it will be marked as **[WAITING TO BE
TESTED]**.
You can help by testing PRs and writing your feedback here on the PR's
page on GitHub. Follow the instructions here:
http://www.azerothcore.org/wiki/How-to-test-a-PR
**REMEMBER**: when testing a PR that changes something **generic** (i.e.
a part of code that handles more than one specific thing), the tester
should not only check that the PR does its job (e.g. fixing spell XXX)
but **especially** check that the PR does not cause any regression (i.e.
introducing new bugs).
**For example**: if a PR fixes spell X by changing a part of code that
handles spells X, Y, and Z, we should not only test X, but **we should
test Y and Z as well**.
<!-- First of all, THANK YOU for your contribution. -->
## Changes Proposed
- This fixes an issue where the .conf files aren't properly generated for the docker build
- With this issue, the dbimport service in the docker compose file would fail to start due to insufficient config.
- related to PR #14707
- create a ".user" file extension for custom configs in `env/docker/etc/`
- Layers the ".dockerdist" file and the ".user" file over the ".dist" file (in that order), and then copies the ".dist" file to the base ".conf" file
- Docker specific config changes go in the ".dockerdist" file and should still be committed to the repo
- User specific config changes go in ".user" file and should not be committed to the repo
- If the ".dist" file and the base ".conf" file are different, the ".conf" will be backed up before the ".dist" file is copied into it
## Issues Addressed:
<!-- If your fix has a relating issue, link it below -->
- There isn't a specific issue, however this was reported and discussed in discord over the course of yesterday and today
## SOURCE:
<!-- If you can, include a source that can strengthen your claim -->
## Tests Performed:
<!-- Does it build without errors? Did you test in-game? What did you test? On which OS did you test? Describe any other tests performed -->
- Executing commands to build and start the game server
- after creating an account, I can log in and play without any issues.
## How to Test the Changes:
<!-- Describe in a detailed step-by-step order how to test the changes -->
1. Execute commands
```bash
$ ./acore.sh docker clean:build && ./acore.sh docker build:nocache && ./acore.sh docker start:app
```
2. Create account and log in as normal
## Known Issues and TODO List:
<!-- Is there anything else left to do after this PR? -->
- The largest issue that comes to mind is this is a breaking change for docker users (though, so was the change that caused this)
- Docker users (and nobody else, of course) can no longer use the ".conf" for custom changes in docker setups.
- Their custom changes will have to be migrated to the ".user" file
- Since the old ".conf" file is backed up, users should have minimal trouble copying the changes in the old ".conf" file to the new ".user" file
<!-- If you intend to contribute repeatedly to our project, it is a good idea to join our discord channel. We set ranks for our contributors and give them access to special resources or knowledge: https://discord.com/invite/DasJqPba)
Do not remove the instructions below about testing, they will help users to test your PR -->
## How to Test AzerothCore PRs
When a PR is ready to be tested, it will be marked as **[WAITING TO BE TESTED]**.
You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:
http://www.azerothcore.org/wiki/How-to-test-a-PR
**REMEMBER**: when testing a PR that changes something **generic** (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but **especially** check that the PR does not cause any regression (i.e. introducing new bugs).
**For example**: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but **we should test Y and Z as well**.
edit: link related PR
* Remove .dist file requirement
* Remove unnecessary string cast
* Add required variables for CI build configs
* More required variables
* Add some more default variables to reduce log output
* One last default value to cut down log spam
* Rewrite conf file bash script
This should use the standard .dest file as a template
* Change dir we copy the dest files from
* actually use the correct file name
* need to use double quotes for variables
* add missing username
* set the correct datadir
* Attempt to fix dbimport
Co-authored-by: Foereaper <foereaper@elunatech.com>