-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3b7a2a
commit 51c4a69
Showing
2 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
hosts: | ||
my_server: | ||
user: deploy_user | ||
host: example.com | ||
port: "22" | ||
|
||
groups: | ||
deploy: | ||
tasks: | ||
deploy: | ||
remote: my_server | ||
run: echo "Deploying application..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Makim Feature Tutorials\n", | ||
"\n", | ||
"This Jupyter Notebook provides in-depth tutorials for key features of Makim:\n", | ||
"1. **Scheduler**: Automating tasks at specified intervals.\n", | ||
"2. **SSH Execution**: Running tasks on remote servers securely.\n", | ||
"\n", | ||
"Each section includes explanations, YAML configuration examples, and how to run these features." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 52, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### 1. Scheduler: Automating Tasks\n", | ||
"\n", | ||
"### What is the Scheduler?\n", | ||
"The Makim scheduler allows you to define recurring tasks using cron expressions.\n", | ||
"\n", | ||
"Writing the Makim Configuration File" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 53, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Overwriting .makim.yaml\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%writefile .makim.yaml\n", | ||
"scheduler:\n", | ||
" daily-clean:\n", | ||
" task: build.clean\n", | ||
" schedule: \"0 0 * * *\" # Runs every day at midnight\n", | ||
"\n", | ||
"groups:\n", | ||
" build:\n", | ||
" tasks:\n", | ||
" clean:\n", | ||
" help: Clean build artifacts\n", | ||
" run: echo \"Cleaning build artifacts...\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 54, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Makim file: .makim.yaml\n", | ||
"┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n", | ||
"┃\u001b[1;35m \u001b[0m\u001b[1;35mName \u001b[0m\u001b[1;35m \u001b[0m┃\u001b[1;35m \u001b[0m\u001b[1;35mTask \u001b[0m\u001b[1;35m \u001b[0m┃\u001b[1;35m \u001b[0m\u001b[1;35mSchedule \u001b[0m\u001b[1;35m \u001b[0m┃\u001b[1;35m \u001b[0m\u001b[1;35mStatus \u001b[0m\u001b[1;35m \u001b[0m┃\u001b[1;35m \u001b[0m\u001b[1;35mNext Run \u001b[0m\u001b[1;35m \u001b[0m┃\n", | ||
"┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n", | ||
"│\u001b[36m \u001b[0m\u001b[36mdaily-clean\u001b[0m\u001b[36m \u001b[0m│\u001b[34m \u001b[0m\u001b[34mbuild.clean\u001b[0m\u001b[34m \u001b[0m│\u001b[33m \u001b[0m\u001b[33m0 0 * * *\u001b[0m\u001b[33m \u001b[0m│\u001b[32m \u001b[0m\u001b[32mInactive\u001b[0m\u001b[32m \u001b[0m│\u001b[35m \u001b[0m\u001b[35mNot scheduled\u001b[0m\u001b[35m \u001b[0m│\n", | ||
"└─────────────┴─────────────┴───────────┴──────────┴───────────────┘\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"!makim cron list" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 55, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Makim file: .makim.yaml\n", | ||
"Successfully started schedule 'daily-clean'\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"!makim cron start daily-clean" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 56, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Makim file: .makim.yaml\n", | ||
"Successfully stopped schedule 'daily-clean'\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"!makim cron stop daily-clean" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n", | ||
"### 2. SSH Execution: Running Remote Tasks\n", | ||
"\n", | ||
"### What is SSH Execution?\n", | ||
"SSH execution allows tasks to be run on remote machines securely.\n", | ||
"\n", | ||
"Writing the SSH Configuration" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 57, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Overwriting .makim.yaml\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%writefile .makim.yaml\n", | ||
"hosts:\n", | ||
" my_server:\n", | ||
" user: deploy_user\n", | ||
" host: example.com\n", | ||
" port: '22'\n", | ||
"\n", | ||
"groups:\n", | ||
" deploy:\n", | ||
" tasks:\n", | ||
" deploy:\n", | ||
" remote: my_server\n", | ||
" run: echo \"Deploying application...\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 58, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# !makim deploy.deploy" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Summary\n", | ||
"- **Scheduler** automates recurring tasks using cron syntax.\n", | ||
"- **SSH Execution** enables remote task execution securely.\n", | ||
"\n", | ||
"Start using Makim to enhance your workflow!" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "makim", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |