Deploying and Promoting to Production
As Kyle begins to work on development with Liferay Cloud, he goes through his first full deployment process by deploying and promoting a simple widget module.
Here, you’ll deploy and test an example widget to walk through the whole process.
Pushing Up New Code
Download an example module with a new, simple widget to deploy to your Liferay Cloud environment for these steps.
-
Open a command prompt within your project repository’s
liferay/
directory. -
Download and unzip the example’s source code into a
modules/
folder.curl https://resources.learn.liferay.com/courses/latest/en/cloud-administrator/cloud-development-lifecycle/liferay-e3v7.zip -O
unzip liferay-e3v7.zip -d modules/
-
Commit and push the source code to your remote repository on GitHub.
git add modules
git commit -m "Add a simple module to push to production."
git push origin [branch_name]
Your infra
environment creates a new build from your push that you can deploy from the Liferay Cloud console once it’s complete.
Deploying to UAT
Next, deploy the build to your UAT environment for testing.
Whether you deploy to UAT or another dev
environment depends on your subscription and your own workflow. Once you configure automatic deployment, you can skip manually deploying to the first environment in the process.
-
In the Liferay Cloud console, click Builds at the top of the screen.
-
Find the new build from your push and click Deploy build to…
-
From the Environment drop-down menu, select your UAT environment.
-
Click the checkboxes to confirm the impact of the deployment.
-
Click Deploy Build.
Your UAT environment’s services restart, and once they are back up, the example module is deployed to the Liferay instance.
Accessing Your UAT Environment
Next, manually test the new widget to ensure it’s working correctly.
-
Navigate to your
infra
environment. -
Click Settings on the left side of the screen.
-
Select the Secrets tab.
-
Click the
lcp-secret-ci-customer-user
secret. -
Click View to confirm the secret value you need to log into your UAT instance.
tipThe default username is
customer
. -
Click the back arrow to return to the list of secrets.
-
Click the
lcp-secret-ci-customer-password
secret. -
Click View to see the secret value. You can click the value itself to copy it to your clipboard.
-
Navigate to your UAT environment.
-
Click Visit Site at the top of the page.
-
When prompted for credentials, enter the username and password you found from the
lcp-secret-ci-customer-user
andlcp-secret-ci-customer-password
secrets, respectively.
Now you have successfully logged in and accessed your UAT Liferay instance.
Acceptance Testing
Next, test the new widget to make sure it’s working properly.
-
Log in as the default administrator.
-
Click the edit icon ( ) at the top of the page to access a list of widgets.
-
From the Fragments and Widgets sidebar, click the Widgets tab.
-
Scroll down and expand the Sample section to find the new widget, E3V7 Widget.
-
Drag it anywhere on the page to see how it looks. The example widget displays simple text.
Now that you’ve confirmed the widget is working, continue to promote the build to production.
Deploying to Production
Kyle needs to get approval from his manager, Marcus, before he can promote the build to production. Once it’s approved, he can deploy the same build to production during a planned period of downtime.
Deploy the build to production now that it’s passed your testing process.
-
In the Liferay Cloud console, click Builds.
-
Using the same build as before from the list, click Deploy build to…
-
Under the Environment drop-down menu, select your production environment.
-
Click the checkboxes to confirm the impact of the deployment.
-
Click Deploy Build.
The production environment’s services restart with the new addition from the build. Once the services are back up, you can visit your production environment’s Liferay instance to see the new widget appear there, too.
Next: configure automatic deployment to speed up the development workflow.