I currently have a client that will be hosting on Azure. I have not used Azure before and am curious how well this can work with Trellis. From looking around it seems like some people have got this setup but I’m not sure exactly where to start or if its even possible. Does anyone have any info to get this setup and working? Any help is much appreciated.
Trellis currently only supports Ubuntu 16.04. Microsoft has some documentation on creating an Ubuntu VM using their tools. I’ve never used Azure for Trellis but if you can create the appropriate VM you should be able to provision it just like you would with any Trellis project.
I see that you can create an Ubuntu 16.04 server. We currently have one wordpress site there and the performance has been horrible. I’m really just trying to decide if its worth it to get things running on Azure or hopefully convert the client to Digital Ocean where I know everything works.
All Trellis does is provision an Ubuntu install for you, and then run zero-downtime deploys by swapping symlinks around. If Azure will give you a standard Ubuntu box w/ SSH, I can’t imagine that using Trellis to deploy to it would be that much different than anything else.
Yes it looks like it should. Guess I actually need to access to server so I can test it
Just want to circle back here for anyone wondering and let them know that Azure works just fine with trellis.
You simply need to:
- create a Ubuntu VM (Trellis now works with Ubuntu 18 or 20)
- set up the Azure SSH keys and hosts in your trellis folder. You may need to convert the ssh key to a pub key using ssh-keygen.
- Set your environment’s
admin_userto your username from the azure VM (you can find this and the ssh info under “Connect”.
- Set up all your other trellis config as usual (production/staging site_vars).
- Point your DNS at the VM IP.
trellis provision <environment>and
trellis deploy <environment>
Worked for me!
- I added the ssh key to my github repo’s deploy keys. Not sure if i needed to., and then point your DNS at the IP address.
- I had to install WP after the first deploy, but not after that.
- I used WP Migrate DB Pro to move my DB and Media up after the first deploy (logged in as usual and then activated/used the plugin).
Thank you for sharing your experience. May I know if this will also work in the App service?
I tried a number of app services. I don’t think Trellis will work with them, as they start with an already instantiated container and then allow you access to folders within that container. I don’t think ansible/trellis could ever be able to do it’s thing and create exactly the environment you wanted inside of one of those containers, but I may be wrong (maybe try a base Ubuntu image?). Also, you’d need to use a separate App Service for MySql, probably redis, etc.
Generally, app services seem to use the “Docker” mentality of open-source environment images, which could work, but seems to be directly at odds with the Trellis philosophy of starting from a base OS and adding all the functionality at the provision step.
Thank you for your reply. I’ve been trying to look for a solution to this. until you mentioned a separate app service for MySQL and other dependencies. I’m more sure now that provision to an app service won’t work. I was able to tunnel though. Unfortunately, I also need to run the provision command under WSL.