-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forge site directory not deleted in teardown #114
Comments
@dev-anthonyrae The directory should get removed by the Forge in 10 seconds after the teardown commend finishes. There might be nothing Harbor can do about this. |
@mehrancodes - We are having the same issue, so I did some testing.
Site files are successfully deleted using SDK and API but not when the delete() is issued via Harbor. |
@keybrdist, @dev-anthonyrae I just tested it, and it removes the folder on the server. Maybe I can try it again with your Harbor .env public keys? |
@mehrancodes I'll try running harbor locally to do some testing. Is it just a matter of setting the env vars and then running |
@keybrdist, You can do that by running php harbor teardown. Same as when you want to provision a site It’s built on Laravel Zero, but used for console apps. Let me know if you need any more help! |
I have run some tests.. tldr; I have to run I setup a base project with the following:
{
"require": {
"mehrancodes/laravel-harbor": "^1.0"
}
} A basic #!/bin/bash
set -e
export FORGE_GIT_BRANCH=xxxxxxx
export FORGE_SERVER=1234
export FORGE_DB_NAME=pr_1128
export SUBDOMAIN_NAME=pr-1128
export FORGE_DOMAIN=tst.xxxxxx.com
export FORGE_GIT_REPOSITORY=xxxxx/xxxxx
export FORGE_TOKEN=eyJ0.....
./vendor/bin/harbor teardown Output: ➜ ./teardown.sh
INFO Start finding the server.
INFO Finding the associated site.
INFO Removing scheduled command.
INFO Removing database with user.
SUCCESS Environment teardown successful! All provisioned resources have been removed.
(base)
➜ ./teardown.sh
INFO Start finding the server.
INFO Finding the associated site.
SUCCESS Environment teardown successful! All provisioned resources have been removed.
(base)
➜ ./teardown.sh
INFO Start finding the server.
INFO Finding the associated site.
FAIL ---> Site not found.
(base) ^^ notice on the 3rd attempt it finally says "Site not found". I had to run it twice to remove all resources. |
UPDATE: I added sleep(30); to DestroySite.php and it successfully deleted everything including site directory on the first attempt. I suspect the delete operation is being called before the other operations are actually complete, and that the Forge API operations are asyncronous and have not completed before DestroySite is called. class DestroySite
{
use Outputifier;
public function __invoke(ForgeService $service, Closure $next)
{
sleep(30);
$service->site->delete();
return $next($service);
}
} Note: I think the above is a good test but perhaps it would be better if you add something more dynamic to make sure previous operations in the pipelines have been been completed before DestroySite is invoked. |
btw, regarding your testing -- This might only be affecting deployments that have other resources. For example.. all my failed tests were launched with FORGE_JOB_SCHEDULER=true. I'm guessing that |
@mehrancodes sorry to tag you. Just wanted to make sure you saw my latest comments on this matter. |
Hello 👋 When deleting a site in Forge, Forge will automatically delete all related jobs and daemons. It will require however that enabling inertia is done via the endpoint for enabling Inertia, so Forge knows that the daemon is related to that site. The same is also true for the deploy key, when deleting a site, Forge will delete the deploy key from Forge also (not the source control providers). |
@olivernybroe, @keybrdist, Thanks for following up! Everything's working great without the Let's see if it works smoothly now without Feel free to open a PR for |
@mehrancodes thanks for fixing it, we will report back to the user that reported having this issue :) Forgot to put disclaimer that I work for Forge 😅 |
@olivernybroe I think that user is me! 🙏 |
Thanks everyone - Will need to update our app with the changes and check. |
When the teardown command runs, the forge site is removed, but the actual folder on the server still exists.
Is this the expected behaviour?
Is it possible to automate the deletion of the the site directory on the server?
The text was updated successfully, but these errors were encountered: