Deployment

Before Deployment

Make sure you're using env=dev and that you don't edit the environment.local (mustn't be env=prod). Otherwise the compile step will simply be skipped (don't compile in Production).

Run ant prepare globally before doing a deployment so that all dependencies in the platform are installed in correct versions.

Deploying your project is a three-step task:

1
Create the software build
2
Test the build
3
Create and rollout an image to the Cloud

While we aim for a fully automated process (including Continuous Integration), there are currently some semi-automated steps involved.

1

Build Software

To build the software you need to perform the following steps:
  1. Boot your VM
  2. cd into your project directory (inside the VM)
  3. Run ant deploy (inside the VM)

The ant deploy command executes a full build chain which includes:

  • ensure correct dependencies and versions
  • run all tests
  • performing code style updates
  • build the software (JS/CSS compile, minifying, chunking, etc.)

Please note that this will take some time.

Once the process has finished successfully, you'll find the updated assets have been generated in the public/assets/.

You can now continue with Test the Build or directly commit and tag the build version for Rollout.

2

Test the Build

You can test the built assets by switching your local environment from development mode to production. This is done by going to the environment.local file inside your Project directory and setting:
env=prod

This will make the base template source the statically built assets instead of using the webpack dev-server. A reload in the browser will show you the result for inspection.

Be sure to switch the environment back after testing.

3

Rollout

Once you're satisfied with the state of built assets, commit them and tag the commit with the current date/time in the following format:
yyyy.mm.dd.hh.ii

You should use ant tag command that we provide, so that all required changes are done during the tag creation. For example, writes the tag command the current version number into the environment config files etc.

$ cd ~/your-project-root
$ ant tag
Buildfile: /home/develop/your-project-root/build.xml

tag:
     [exec]	[master b01f5032] Built release 2019.08.02.10.47
     [exec]	2 files changed, 56 insertions(+), 1 deletion(-)
     [exec]	create mode 100644 paas/catwalk/src/ant/tag.xml
     [exec]	Current Branch master is up to date.
     [exec]	To github.com:frontastic-developers/customer-project.git
     [exec]	1eb316cf..b01f5032  master -> master
     [exec]	To github.com:frontastic-developers/customer-project.git
     [exec]	* [new tag]		2019.08.02.10.47 -> 2019.08.02.10.47

BUILD SUCCESSFUL
Total time: 8 seconds

This command creates the tag and pushes it directly to GitHub so that it's ready to deploy.

Deployment the Cloud Way

Now that you have a software version that you are satisfied with, you can trigger a deployment. Currently the Deployment part doesn't provide a fancy UI and must be done on the command line with curl or a similar tool.

To get the command you should open the following URL:

https://<your-project>.frontastic.io/developer/deployment

at the bottom of the page you find a example curl command with your current session id, similar to the below:

curl \
	-X POST \
	--cookie 'FCSESSID0815=c95914cb7a3ef945f56cd0053ab01234' \
	--header 'Content-Type: application/json' \
	-d '{"tag": "####.##.##.##.##"}' \
	'https://<your-project>.frontastic.io/api/deployment/schedule?environment=$env'

Copy this command into your shell and replace ####.##.##.##.## with concrete tag you created before and the $env with staging or prod depending on the environment you want to deploy to.

If you already have a Frontastic API-Token you can also use the token based approach instead of your current Backstage session:

curl \     
	-X POST \    
	--header 'X-Frontastic-Api-Token: 8023dc50-17d4-4223-bc06-cfd923c5e642' \     
	--header 'Content-Type: application/json' \     
	-d '{"tag": "####.##.##.##.##"}' \     
	'https://<your-project>.frontastic.io/api/deployment/schedule?environment=env'

Getting Current Deployment Status

At the moment, status information is very limited and there's a timeframe of around five minutes of silence where we spin off new machines etc. But you can access the status for the deployment with the following command:

curl \
	-X POST \
	--header 'X-Frontastic-Api-Token: 8023dc50-17d4-4223-bc06-cfd923c5e642' \
	--header 'Content-Type: application/json' \
	-d '{"tag": "####.##.##.##.##"}' \
'https://<your-project>.frontastic.io/api/deployment/status?environment=env'

We're working on adding more status information to this service endpoint.


‹ Back to Article List

Next Article ›

Deploying a Branch

Still need help? Contact Us Contact Us