Cryptocoin Demo Project Deployment with Spring Boot + MySQL to Azure
Creating Azure Database for MySQL Servers
- Enter Azure Database for MySQL to search bar. Create new database.
- Write your desired server name.
- Select your subscription.
- Select your Resource Group. If you dont have existing Resource Group you need to create.
- Select source. We used "Blank".
- Create your admin login name, password.
- Select your location and version.
- Pricing tier: We used standart General Purpose tier.
- Go to your database settings --> Connection Security.
- Add client Ip then save it. This will allow your MySQL Workbench to connect Azure Database after you.
- Go to Connection Strings.
- Copy your server url to your app (we used JDBC).
Go to MySQL Workbench
- Host name (serverName).mysql.database.azure.com
- Create new server with username and password which you created. (which Azure Database for MySQL Server --> Overview page has hostname and your username will be Server Admin login name.)
- Port: enter your app port (we used 3306)
- Test Connection if you get successful go to next step.
Deploying App with Azure Toolkit for IntelliJ Plugin
- If you dont have this plugin please install to your intellij.
- Right click to your project -> Azure -> Deploy to Azure.
- Name: create your configuration name.
- Artifact: select your project's artifact.
- WebApp select "Create New WebApp".
- Name: select your website name.
- Subscription: select your subscription.
- Platform: Windows.
- Web Container: Tomcat 8.5.
- Resource Group: select "Create New" -> enter your new Resource Group Name.
- App Service Plan: select "Create New".
- ServicePlan: create your service plan name.
- Location: select your location.
- Pricing Tier: Select your tier (We used Free_F1).
- Click OK.
- Click Run.
Creating new Container Registry
- Go to search bar write "container registries"
- Add: create new container registry.
- Registry name: select your container name.
- Subscription: select your subscription.
- Resource Group: select or create your resource group.
- Location: select location.
- Admin user: select enable.
- SKU: select "standard".
- Create.
Building and Pushing Docker Image
- For creating dockerfile we used "Azure Toolkit for IntelliJ" plugin.
- Go to intellij -> right click to your project.
- Azure -> Add Docker Support (it will create your dockerfile).
- Go to azure portal -> Container registry which you created -> Access keys.
- You will see your "Registry name", "Login server", "Username", "password", "password2".
- Go to your project file inside then open terminal there -> docker login "Your Login Server Name".
- Enter your username and password from azure portal access keys.
- Write -> docker build -t "Your Login Server Name"/"App name in container which you just will create":"Tag name(we used latest)".
- Some example -> docker build -t demoapp.azurecr.io/demo-app:latest . (after one space used dot).
- Now push your project with docker -> docker push "Your Login Server Name"/"App name which you created":"Tag name(we used latest)".
- Some example -> docker push demoapp.azurecr.io/demo-app:latest
Creating Azure Web App
- Go to search bar write "web app for containers".
- App name: write your website name.
- Subscription: select your subscription.
- Resource Group: Select your resource group.
- OS: Select Linux
- App Service Plan: Click -> Create New ->
- App Service Plan: write your app service plan
- Location: select your location
- Pricing tier: select your tier
- Select OK
- Configure container: click ->
- Image source: select "Azure Container Registry"
- Registry: select your registry
- Image: select your image
- Tag: select your tag
- Apply.
- Create.