Apple Script to Automate MicroServices
When working on various projects, so much of the time there are multiple services that need to get booted up from the terminal.
In the instance of several projects I'm working on, there is a dashboard, public, backend then code generation services and of course executing Stripe's CLI to re-route local information.
All of this can lead you running through multiple terminals in tabs to initiate each of these services.
While this was working just fine at first, I found myself frustrated whenever I needed to kick up everything constantly changing into directories and wanted to automate the process!
Applescript's to the rescue.
You can access the apple script editor on your local with a quick search for "Applescript editor".
Here is what my eventual configuration looks like:
tell application "iTerm"
create window with profile "App0"
tell the current window
create tab with profile "App1"
create tab with profile "App2"
create tab with profile "App3"
create tab with profile "App4"
create tab with profile "App5"
create tab with profile "App6"
end tell
end tell
I create a small snippet that instructs the iTerm app to automatically open and create various tabs with pre-configured profiles.
By pre-configuring these profiles, I can now create a nice little icon that sits on y toolbar to initiate the environment!
Great.. so how do you set up these profiles?!
In iTerm, you can configure profiles by selecting iTerm -> Preferences and selecting the profile tab.
From here you can configure exactly how your app will start, passing in any of the other configuration options you wish to use.
Local service automation complete!