In this article we analyze the procedure to associate a custom domain managed by CloudFlare with an application deployed on Zephyr Cloud .
The scenario:
1
You use CloudFlare to manage your domains
2
Domains can be registered using CloudFlare or any other services, such as NameCheap, in our example.
3
You want to use Zephyr Cloud to deploy your application in a custom domain
How to deploy Angular & React on Zephyr Cloud
If you have never tried Zephyr, and therefore do not know how it works, or if if your goal is just to deploy a static FrontEnd application (developed in Angular, React or any other framework) we recommend you read the previous articleDeploy Static applications (Angular, React,...) on Zephyr Cloud.
The procedure is really simple and takes a few minutes to be configured
Open the dashboard of NameCheap (or your supplier) and select the domain to edit, in our case fbion.dev.
Go to the NameServer section, select Custom DNS (the default NameCheap setting is Namecheap Basic DNS) and add the nameservers you have copied from the CloudFlare dashboard
Are using another Domain provider?
If you use another domain provider, the screens may be different, but the procedure should be very similar.
2
Wait...
Now we have to return to the CloudFlare screen where it suggested us to set up new nameservers:
Refreshes the page and you should have a success message.
This may take some time
This procedure may take a few minutes or hours.
In our case, with NameCheap, it took about 3 or 4 minutes
3
Get Zone ID
Scrolling down the same page you will find the Zone Id parameter.
Copy this value that we will need in the configuration of Zephyr
Further down in the same panel of the Zone ID you find a link to generate a new token Get your API token:
What is the token for?
This token gives permission for Zephyr to manage your deployed files.
It enables the system to handle both uploading your content and making it available to users.
Think of it as a special key that lets Zephyr set up everything needed to store and deliver your assets.
Here you can find the list of created resources.
So click the Create Token button:
2
Set Token Permissions
Now we have the option to choose different templates to set the token permissions.
However, we opt for a custom configuration.
Click the Get Started button in the Custom Token panel:
Now we have to configure the token, defining:
1
a descriptive name: this does not affect the process, so use whatever you prefer
2
permissions
3
Zone Resources
Below you can see the Permissions settings to use and Zone Resources.
We are ready to configure CloudFlare in the Zephyr dashboard.
Go to the configuration page of the project created in the previous steps
Click the Settings Tab
Select Default Deployment Integration
Click CloudFlare - Add Integration
Now we have to configure CloudFlare by entering the value of Zone ID and the API Token that we generated from the dashboard of CloudFlare in the previous step.
We also set the CloudFlare application name that it's used to define a worker in CloudFlare (you will see it in the next recipes).
Zephyr allows us to easily manage versioning via the Versions page available in each project.
From this page you can:
1
see the whole list of all deploys
2
Rollback to a previous version
For example, we did 3 deploys so far.
During our tests we did a fourth deploy (using npm run build) and as a result we see 4 versions in this Version History list:
Rollback
You can also go back to a previous version by clicking the Deploy button:
Watch the video to see the steps from build to versioning: