Templates
Next.js
13min
next js is an open source, react framework, that helps developers build web applications, with all the features you need for production hybrid static & server rendering, typescript support, smart bundling, route pre fetching, and more microtica offers a ready to use template to deploy a next js application as part of our free templates pack you can deploy a next js application on our demo kubernetes cluster to get started when ready, you can self host next js on your own aws account and setup a production ready solution in minutes one click deploy click deploy with microtica below and follow the template steps to deploy your next js application on your aws account 1\ create an account creating a microtica account is totally free you can do it by signing up with your email or with your git account 2\ select the next js template on the left side, you can see a link to the source code of this template it will redirect you to microtica's github account 3\ create git repository as a first step, you need to connect a git account (github, bitbucket, gitlab, or codecommit) microtica defines a repository name by default for each template, but you can change it if you already have a git account connected to microtica, you can choose it from the list we will create a new repository on your account with the provided name, and every git push will be deployed automatically in microtica follow this guide on how to import your existing application in microtica https //docs microtica com/import an existing nodejs application , if you already have a node js application source code 4\ configure template after creating your repository, you need to enter a name for the application, to be able to distinguish it from other apps in the applications tab you can customize this template to meet your requirements with environment variables you can update the configuration later in app settings 5\ select a cluster the next step is choosing the kubernetes cluster where your application will deploy there are three options you can select to run your container app create a new eks cluster on the spot connect an existing cluster connect kubernetes cluster 5 1 create a new eks cluster on the spot if you want to deploy your next js application on your own aws account, you can create an aws managed kubernetes (eks) cluster, by clicking on the create amazon eks cluster button this is the recommended option for production applications, as it gives you full ownership of your cloud infrastructure and applications this action will open the popup shown in the image above you can select the environment in which you'd want this cluster to be deployed if you don't have an existing environment, you can create one by selecting the create environment action from the dropdown menu once you select an environment, the next step is to select an aws account and region where the eks cluster will be deployed if you don't have a connected aws account, you can connect one right here by clicking the connect aws account button this will initiate a cloudformation stack that will give microtica permissions to provision infrastructure on your aws account once you create the stack, the connection will be established automatically and you'll be able to see the aws account in the dropdown list of accounts select the account, select a region, and then click on continue to move to the deployment of your environment deploying a new kubernetes cluster on your aws account could take up to 15 mins 5 2 connect an existing cluster in microtica you can also connect an existing kubernetes cluster that you have and deploy your applications there you can connect kubernetes clusters running on basically any cloud provider or on premise by connecting a cluster you can use the full capabilities of microtica’s kubernetes automation to connect an existing kubernetes cluster in microtica and deploy your node js application there, follow the documentation linked below👇 connect an existing kubernetes cluster docid jijdoljpe9gsunp7ktkz 6\ deploy the template to your cluster once you’re done with the cluster selection, you will see a summary of all the previous steps and what will be deployed with this template you can go ahead and trigger a deployment of the environment by clicking on the deploy button it takes approximately 4 5 minutes (15 20 with eks) for this application to be deployed on the cloud in the meantime, you can follow the detailed deployment logs by clicking the view deployment button if you're deploying an eks cluster on your aws account when the eks cluster deployment is finished, or if you're deploying on our shared kubernetes cluster, click the view logs button to follow the application deployment 7\ access the application when the deployment is finished, you will see a view application button, that leads you to the app overview tab here you can assign a domain to your application, to be able to access it later you can use a microtica assigned domain which is free, or setup your own custom domain follow the steps to complete the exposure of your next js app on the internet for even more information, you can also look at the deployments and monitoring tabs, where you have the pipeline history, resource consumption metrics, and logs for your instances to learn more about how to scale your next js application in microtica, read the following article about scaling applications in microtica https //docs microtica com/scaling optimize aws cost to save costs while using next js in a non production environment, consider running it from monday to friday, 8 hours per day this schedule can help you achieve at least a 65% reduction in your cloud expenses in the resources or cost dashboard , create a saving schedule to implement these cost saving measures