Envoyer execute the commands you write, so write a command including submodules.
Submodules?
Does Envoyer include Submodules when it clones from your repo?
@pmall I know I can, but I'd rather know if Envoyer includes the recursive option when it clones the repo, which would mean I wouldn't have to do this.
Envoyer does nothing by itself it executes the command you write
@pmall I've done a bit more testing, and no, I've not been successful doing this. Envoyer is cloning the release when I deploy, and I can't do something like the following:
cd {release} # I am using double brackets, but Laracasts seems to filter double brackets out
git submodule init
git submodule update
As it just fails and says that there was no valid Git Repo:
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
And Envoyer does a lot of things by itself; I cannot customise the cloning command for the default "Clone New Release" task it runs, so is there any other way I can do this?
@Oyed did you solve this?
@JoeDawson No - I contacted Taylor and due to how Envoyer pulls from Git, this isn't possible.
@Oyed thanks for getting back to me. That's a shame.
thanks for clarifying
Here's a workaround. Add this as deployment hook after "Clone New Release":
cd {{release}}
rm -rf ..?* .[!.]* *
git clone -b YOUR_BRANCH YOUR_REPOSITORY_CLONE_URL .
git submodule update --init --recursive
Replace YOUR_BRANCH with a branch you use for deployments. Replace YOUR_REPOSITORY_CLONE_URL with the full url of your remote repository (i.e. [email protected]:/repo/address.git)
@neochief Don't forget to add a symlink back of your .env file on your current release.
cd {{release}}
rm -rf ..?* .[!.]* *
git clone -b YOUR_BRANCH YOUR_REPOSITORY_CLONE_URL .
git submodule update --init --recursive
ln -s /home/forge/default/.env .env
In my case, my repo and submodules are private so this was slightly more complicated.
On your server
-
cd ~/.ssh && ssh-keygen -
cat ~/.ssh/key-for-github.pub - On a github machine user or equivalent user with read access to your repos. Add your public key.
- By pass known hosts checks for github.com
-
sudo nano ~/.ssh/config - Add exception for github (below)
-
sudo chmod 644 ~/.ssh/config
-
Host github.com
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
On Envoyer
Add an afterdeployment hook to "Clone New Release"
cd {{release}}
rm -rf ..?* .[!.]* *
ssh-agent bash -c 'ssh-add ~/.ssh/key-for-github; git clone -b your-branch-name [email protected]:user/repo.git .; git submodule update --init --recursive'
rm -rf storage
ln -s ../../.env .env
ln -s ../../storage storage
Depending on your setup, you should also double check your app (or www-data) has permissions in storage folder.
Be mindful, you're overwriting how Envoyer clones your release. So whatever you specified in the branch name in the project settings in Envoyer does not matter anymore.
Workflow
Make sure your let your devs know about submodule updates and running locally.
git submodule update --init --recursive --remote
@neochief and @oscarbatlle IMPORTANT ! You also missed the symbolic link for the storage folder that sits outside your releases folder.
Please or to participate in this conversation.