In our company, we have a development environment that we deploy code on it multiple times in a day, and each time we must SSH to our server and run "deploy" command. In iOS 13, a new Shortcuts application added and it has a lot of automation feature that you can use it.
In this post, I want to show you how you can use it to deploy your server with this application or just by calling Siri.
Requirements
Your deployment process must not have a lot of manual processes. For example, in our situation, we use Gitlab CI and Docker Swarm.
Every time we push new code to our development branch, Gitlab CI runs and build docker images and push it into our local docker repository.
Then we SSH into our development server and run Docker Swarm deploy command to deploy new images.
Set up Shortcuts
To set up the Shortcuts app on your phone, follow these simple steps:
- Open Shortcuts app on your iPhone.
- Tap on
Create Shortcut
. - Tap on
Add Action
. - Select
Scripting
from the list. - Find
Run Script Over SSH
and select it. - In this section, you must enter your host address, SSH port, username, password(you can use SSH key either), and your deploy command.
In our example, It's
docker stack deploy -c ~/development.yml develop
- Select a name for your action, like:
Deploy development
. - Then, a new action adds to your shortcuts list.
Now, Call Siri to deploy your server. Hey Siri, Deploy development
.
More posts in my blog - peyman.blog
Top comments (0)