In this brief tutorial we'll cover how to deploy a dockerised shiny application to the azure app service.
You will need:
git clone
or by downloading a .zipFirst we need to build the docker image locally before we set up things on Azure. To do this we need to start a terminal and ensure the Docker Daemon is running (you can check this by ensuring that Docker Desktop is in the running state).
In a terminal:
Docker will build our container image and if successful you'll see the final line:
We can now test run the Docker image to make sure it runs as expected. We do this by using the docker run
command.
When this runs it won't return the prompt but will serve the application on http://localhost:3838/
We can interrupt docker run
by pressing CTRL+C to stop the container. If it runs and you can see:
Everything is running as expected! Yay!🎉
The simplest way to deploy to azure is via the Visual Studio Code editors Azure App Service extension. This allows you to manage the deployment from a graphical user interface.
This should get you to a place where you've successfully deployed the shinyapp to Azure and can visit the web page.
After issues with Azure MariaDB service I used Azure MySQL service (v8.0) instead. I would configure the service with the following settings:
For networking we want essentially to be able to dump the data from your machine and then just have your container app talk to the database and that's it. Therefore, we want to aim to keep the firewall as closed as possible. This may take some fiddling to get exactly right but I was able to get the app configured using the specific IP addresses that the Azure App service uses.
You can find this information for your app in the Azure portal when you select your App:
To do this you'll need a mysql command line client or similar. If you use a command line client you can upload the database with the following command:
Where:
msqldatabase_URL
is the full URL available on the portal of your database serverDB_USER
is the user account you created for the databaseSRV_NAME
is the data base server nameDB_PASSWD
is the user password for the database you created