How we use Lagoon
One of the first questions you might be asking is 'what is Lagoon?', but before we answer that, it would be good to get some context on how things were done before Lagoon.
Before Lagoon
When developing websites, it is common to have at least two environments:
- Production: This is the live site accessible via the internet, representing what the client sees as their website.
- Development: This environment allows you to test and implement changes before they are deployed to the production site.
Setting up development environments can be done in a few ways. You can choose to host it on the internet or work locally on your own computer. However, both options have their drawbacks:
Hosted
- Requires a network connection to work on, limiting flexibility.
- Slower workflow as changes need to be uploaded before they can be reviewed.
- Security concerns arise as the site is accessible on the internet and needs to be safeguarded.
Local
- Involves a different setup compared to the production environment on the internet.
- Configuration challenges, such as setting up domain names and debugging locally.
- Potential conflicts when working on multiple projects simultaneously.
When it comes to deploying changes from the development environment to production, there are two primary options:
- Using FTP: This method involves manually uploading the necessary files to the production server.
- SSH and version control: With this approach, you can SSH onto the server and utilise version control systems along with package managers to synchronise all the changes.
While these methods are commonly used, they are prone to human error. Additionally, working on a production website during the deployment process may result in downtime.
Enter Lagoon
amazee.io’s Lagoon is a container-driven hosting solution that ensures consistent environments between local development and production. By utilising the same container images locally as in production, developers can seamlessly transition their work from local to live environments. As Lagoon is container-driven, it allows for the simultaneous execution of multiple containers, which are automatically configured. This works well for us as we can have many projects set up simultaneously and it no longer matters if they need different components.
To work with Lagoon locally, you only need to set up Docker on your machine. Once Docker is configured, you can use Docker Compose to build the required container images. When the setup process is complete, you'll have a fresh copy of your site ready for development, with all the necessary components included.
Deployments
Deploying to different environments with Lagoon is a straightforward process. Lagoon requires the use of a version control system, typically for us it’s GitHub, where each environment is connected to a specific branch. For example, the development environment is connected to the dev branch.
To deploy our changes to an environment, all we need to do is merge code into the corresponding branch. This triggers the deployment and build process. It's worth noting that during the build process, the website remains active. No changes are deployed until the entire process is successfully completed. This approach offers several benefits:
- Active environment preservation: The current website remains accessible and unaffected until the deployment process is finalised. This ensures that users can continue to access the site without disruption.
- Failure notifications: If any issues arise during the build process, you will receive a notification. This allows you to promptly address any errors or conflicts that may have occurred, ensuring the stability of the environment.
By leveraging Lagoon's deployment workflow, we can confidently deploy our changes while maintaining a reliable and uninterrupted user experience.
Dashboard & CLI
Lagoon offers us a user-friendly dashboard that serves as a central hub for managing our environments. This dashboard provides a plethora of helpful features that enhance our workflow. With it, we can effortlessly create backups, make modifications to our environments, run specific processes, and access essential data. The inclusion of a graphical user interface (UI) greatly improves the overall usability and simplifies tasks for all members of our team, regardless of their technical expertise. The intuitive UI ensures that everyone can navigate and interact with the Lagoon hosting solution with ease.
However, when it comes to handling more complex or administrative tasks, we rely on the CLI tool. With this tool, we can effectively administer users, make changes to environment rules, swiftly access all the different containers, update environment variables, and perform various other tasks.
In addition to the CLI, we have developed a few tools that assist us in automating tasks - for example, a tool that retrieves details about our sites. Thanks to the features provided by Lagoon, completing this task took no longer than a day. Lagoon's functionality greatly facilitated the process and made it much more convenient to accomplish.
Summary
For us, Lagoon goes beyond being just a 'web host.' We fully embrace its features throughout the entire development process, from local environments to production. The tools provided by Lagoon have significantly accelerated our development speed, while its comprehensive set of features enables us to work more efficiently. With Lagoon's seamless setup, we no longer have to dread deployments, as the process has become hassle-free and reliable. If you want to know how you can benefit from a similar setup, reach out to us today!