L
L
Lagoon
Search…
First Deployment of Drupal
It's time! It's time for the first deployment into Lagoon! We hope you are as excited as we are!
excited

1. Make sure you are all set

In order to make your first deployment a successful one, please make sure that your Drupal Project is Lagoonized and you have set up the project in Lagoon. If not, don't worry! Follow the Step-by-Step Guide which show you how this works.

2. Push!

With Lagoon, you create a new deployment by pushing into a branch that is configured to be deployed.
If you don't have any new code to push, don't worry, you can run
1
git commit --allow-empty -m "go, go! Power Rangers!"
2
git push
Copied!
This will trigger a push, and the Git hosting will inform Lagoon about this push via the configured webhook.
If all is correct, you will see a notification in your configured chat system (this is configured by your friendly Lagoon administrator):
Slack notification of a deployment starting.
This tells you that Lagoon has just started to deploy your code. Depending on the size of the codebase and amount of containers, this will take a couple of seconds. Just relax. If you'd like to know what's happening now, check out the Build and Deploy Process of Lagoon.
You can also check your Lagoon UI to see the progress of any deployment (your Lagoon administrator has the info).

3. A fail

Depending on the post-rollout tasks defined in .lagoon.yml , you might have run some tasks like drush updb or drush cr. These Drush tasks depend on a database existing within the environment, which obviously does not exist yet. Let's fix that! Keep reading.

4. Synchronize local database to the remote Lagoon environment

With full Drush site alias support in Lagoon, you can synchronize a local database with the remote Lagoon environment.
You may have to tell pygmy about your public keys before the next step.
If you get an error like Permission denied (publickey), check out the documentation here: pygmy - adding ssh keys
First let's make sure that you can see the Drush site aliases:
1
drush sa
Copied!
This should return your just deployed environment (let's assume you just pushed into develop):
1
[drupal-example]cli-drupal:/app$ drush sa
2
@develop
3
@self
4
default
Copied!
With this we can now synchronize the local database (which is represented in Drush via the site alias @self) with the remote one (@develop):
1
drush sql-sync @self @develop
Copied!
You should see something like:
1
[drupal-example]cli-drupal:/app$ drush sql-sync @self @develop
2
You will destroy data in ssh.lagoon.amazeeio.cloud/drupal and replace with data from drupal.
3
Do you really want to continue? (y/n): y
4
Starting to dump database on Source. [ok]
5
Database dump saved to /home/drush-backups/drupal/20180227075813/drupal_20180227_075815.sql.gz [success]
6
Starting to discover temporary files directory on Destination. [ok]
7
You will delete files in [email protected]:/tmp/drupal_20180227_075815.sql.gz and replace with data from /home/drush-backups/drupal/20180227075813/drupal_20180227_075815.sql.gz
8
Do you really want to continue? (y/n): y
9
Copying dump file from Source to Destination. [ok]
10
Starting to import dump file onto Destination database.
Copied!
Now let's try another deployment, again an empty push:
1
git commit --allow-empty -m "go, go! Power Rangers!"
2
git push
Copied!
This time all should be green:
Deployment Success!
Click on the links in the notification, and you should see your Drupal site loaded in all its beauty! It will probably not have images yet, which we will handle in Step 6.
If it is still failing, check the logs link for more information.

5. Synchronize local files to the remote Lagoon environment

You probably guessed it: we can do it with Drush:
1
drush rsync @self:%files @develop:%files
Copied!
It should show you something like:
1
[drupal-example]cli-drupal:/app$ drush rsync @self:%files @develop:%files
2
You will delete files in [email protected]:/app/web/sites/default/files and replace with data from /app/web/sites/default/files/
3
Do you really want to continue? (y/n): y
Copied!
In some cases, though, it might not look correct, like here:
1
[drupal-example]cli-drupal:/app$ drush rsync @self:%files @develop:%files
2
You will delete files in [email protected]:'/app/web/%files' and replace with data from '/app/web/%files'/
3
Do you really want to continue? (y/n):
Copied!
The reason for that is that the Drupal cannot resolve the path of the files directory. This most probably has to do that the Drupal is not fully configured or has a missing database. For a workaround you can use drush rsync @self:sites/default/files @develop:sites/default/files, but we suggest that you actually check your local and remote Drupal (you can test with drush status to see if the files directory is correctly configured).

6. It's done!

As soon as Lagoon is done building and deploying it will send a second notification to the chat system, like so:
Slack notification of complete deployment.
This tells you:
    Which project has been deployed.
    Which branch and Git SHA has been deployed.
    A link to the full logs of the build and deployment.
    Links to all routes (URLs) where the environment can be reached.
That's it! We hope that wasn't too hard - making devOps accessible is what we are striving for.

But wait, how about other branches or the production environment?

That's the beauty of Lagoon: it's exactly the same: Push the branch name you defined to be your production branch and that one will be deployed.

Failure? Don't worry.

Did the deployment fail? Oh no! But we're here to help:
    1.
    Click on the logs link in the error notification. It will tell you where in the deployment process the failure happened.
    2.
    If you can't figure it out, ask your Lagoon administrator, they are here to help!
Last modified 3mo ago