This tutorial will demonstrate how to manage configuration versions and releases in OpenResty Edge. Our relational database used by the web console has built-in support for version control.

Embeded image

As always, let’s go to the OpenResty Edge’s Admin web console. This is our sample deployment of the console. Every user has her own local deployment.

We still use our continuing sample application for the test-edge.com domain.

Screenshot

Enter the application.

Screenshot

First we add a simple page rule to output a custom response body.

Screenshot

Create a new page rule.

Screenshot

We do not specify a condition for this rule. So it will fire unconditionally.

Screenshot

Add a new action for returning a response directly.

Screenshot

We can search for the “Output response body” action.

Screenshot

Screenshot

Select it.

Screenshot

Here we specify the “text/plain” Content-Type header.

Screenshot

And specify the “Hello world” response body.

Screenshot

We need to make sure that this rule always runs before other rules. Let’s mark it as an Always-Top rule.

Screenshot

We skip any subsequent rules if this rule is matched.

Screenshot

And then create it.

Screenshot

We can see our page rule is already listed here.

Screenshot

Our new page rule is not online yet since it is still a pending change.

We can push it out by making a new configuration release.

Screenshot

We could use this Clear button if we want to clear any pending changes. We don’t want to clear it now.

Screenshot

Before making a config release, we can check out the details of the pending changes.

Just click this button to check out the diff for the change.

Screenshot

We provide a readable textual description for the changes.

Screenshot

And also the changes in the JSON format.

Screenshot

Let’s can make the new release now.

Screenshot

You have an option to release to your own staging gateway nodes only.

Screenshot

In that case, this config release will have the type “Staging”. We’ll demonstrate this in a future video tutorial. Otherwise it will be of the type “Normal”.

Embeded image

Add some notes or comments here to describe the release. This is optional though.

Screenshot

Then ship it by clicking on the Release button.

Screenshot

It is fully synchronized now.

Screenshot

Now the new page rule has been pushed to all the gateway clusters and servers.

Our configuration changes do NOT require server reload, restart, or binary upgrade. So it’s very efficient and scalable.

Embeded image

Then on the terminal, we can send a test request to our application.

1
curl http://test-edge.com/

The test-edge.com domain is already resolved to our gateway node servers managed by OpenResty Edge.

screenshot 1

Run it.

screenshot 3

We indeed got the “Hello world” response body.

Back to the Releases page, we can browse all the release history in this table.

Screenshot

Here we can see who authored each release.

Screenshot

And also what time the release was made.

Screenshot

You can check out the operation type, which can be either a “Release” or a “Rollback”.

Screenshot

The Release type can be either a Normal one or Staging one.

Screenshot

We also can expand the details of each historical release here.

Screenshot

It still has the textual description.

Screenshot

Let’s edit our new page rule a bit. Go back to the page rules page.

Screenshot

Edit this rule.

Screenshot

Let’s change the response body to “Happy hacking!”

Screenshot

Save it.

We now have a new pending change again.

Screenshot

Make another new config release.

Screenshot

Check the details of the pending change again.

Screenshot

It shows that we replaced the “Hello world” message with “Happy hacking”.

Screenshot

Let’s release this pending change.

Screenshot

This time we add a comment “Say happy hacking”.

Screenshot

Ship it.

Screenshot

A new release is pushed out.

Screenshot

The release history is also updated.

Screenshot

Let’s send a test request on the terminal again.

1
curl http://test-edge.com/

screenshot 1

Run it.

screenshot 2

The response body is indeed changed to “Happy hacking”.

Next, say, we want to revert the latest config release.

Screenshot

Just click on this “Revert this release” button.

Screenshot

Confirm to revert.

Screenshot

The release revert is now pushed out to all the gateway servers.

Screenshot

Now you see the latest Operation log has the type “Rollback”.

Screenshot

We test it out again on the terminal.

1
curl http://test-edge.com/

screenshot 1

Run it.

screenshot 2

It indeed turns back to “Hello world” now.

We can rollback to an even older release.

Say, we want to rollback to the second last release this time.

Screenshot

We could just click on this “Rollback to this release” button. Feel free to try it out yourself.

Screenshot

This is what I’d like to cover today.

Screenshot

If you like this tutorial, please subscribe to this blog site and/or our Vimeo account and/or our YouTube channel. Thank you!

About This Article and Associated Video

This article and its associated video are both generated automatically by our OpenResty Showman product from a simple screenplay file.

About The Author

Yichun Zhang is the creator of the OpenResty® open source project. He is also the founder and CEO of the OpenResty Inc. company. He contributed a dozen open source Nginx 3rd-party modules, quite some Nginx and LuaJIT core patches, and designed products like OpenResty Edge, OpenResty XRay, and OpenResty Showman.

Translations

We provide the Chinese translation for this article on blog.openresty.com.cn. We welcome interested readers to contribute translations in other natural languages as long as the full article is translated without any omissions. We thank them in advance.

We are hiring

We always welcome talented and enthusiastic engineers to join our team at OpenResty Inc. to explore various open source software’s internals and build powerful analyzers and visualizers for real world applications built atop the open source software. If you are interested, please send your resume to talents@openresty.com . Thank you!