I need to change the GitHub repository for a website and it's staging website. I read that all I had to do was remove the existing site which uses the old GitHub repository from the server and then add the site again using the new GitHub account.
I thought I would test this with the staging server first. The website was successfully deleted. I then began the process of adding the website using the new GitHub repository.
I start by creating a new .env file using the Environment tab in Forge. I can confirm that the .env is created and that all the details are correct - I've checked five times. Everything is connecting well and the deployment begins, but then the following error is thrown. I've also tried deploying using the old GitHub account, but the same error occurs. It appears that during the process of deployment the .env is deleted which is most likely causing the problem.
Generating autoload files
> php artisan clear-compiled
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO)
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
I certainly am @alexhackney.
And I've confirmed they're correct by connecting to the database using Sequel Pro and typing mysql -p after I sshed into the instance.
I click on the Sites tab and enter the following details for the site:
Root Domain: staging.website.com
Web Directory:
I click 'Add Site'.
The website is created. If I ssh into the instance I can see the following directory:
/home/forge/staging.website.com/index.php
I click on the 'Manage' link for the website: staging.website.com
I click on the 'Environment' tab, then click 'Edit Environment'. I enter all the relevant data in the pop and save.
If I ssh into the instance I can see the .env file has been created in the following directory:
/home/forge/staging.website.com/
I click on the 'Apps' tab, and enter the following information and click 'Install Repository'.
Provider: Github
Repository: thomvincent/website
Branch: develop
Installation Options: Checked
The deployment begins, but then throws the error I posted above.
If I ssh into the instance I can see the following directory is now empty. The index.php and .env have been deleted.
/home/forge/staging.website.com/
I'm using Forge to generate all the relevant files and folders. I only sshed in to see what was happening.
As expected the 'App' did not install because of the missing DB information because there was no .env file.
And then added the relevant environment information via the 'Environment' tab.
My final option is to spin up a new instance and start completely from scratch which makes Forge a little less useful that I had hoped.