{"id":34754312,"url":"https://github.com/lucrnz/mypli","last_synced_at":"2026-05-27T14:33:57.673Z","repository":{"id":154950237,"uuid":"592576348","full_name":"lucrnz/mypli","owner":"lucrnz","description":"API for automatic remote deployment","archived":false,"fork":false,"pushed_at":"2023-02-09T13:59:38.000Z","size":89,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-21T15:49:14.972Z","etag":null,"topics":["api","deployment","deployment-automation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucrnz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-24T02:53:42.000Z","updated_at":"2023-05-03T07:22:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"823fd985-e664-434f-8e6e-5b2b0dac054e","html_url":"https://github.com/lucrnz/mypli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lucrnz/mypli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucrnz%2Fmypli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucrnz%2Fmypli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucrnz%2Fmypli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucrnz%2Fmypli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucrnz","download_url":"https://codeload.github.com/lucrnz/mypli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucrnz%2Fmypli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33570992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","deployment","deployment-automation"],"created_at":"2025-12-25T05:29:22.768Z","updated_at":"2026-05-27T14:33:57.666Z","avatar_url":"https://github.com/lucrnz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## mypli\n🚀  API for automatic remote deployment\n\n[Write up](https://lucdev.net/blog/deployment-tool)\n\n## Routes\n\n| Route | Method | Description\n| --- | --- | --- |\n| `/{host_name}/{service_name}/{action_name}` | `GET` | This triggers the action `action_name` on the service `service_name`, at the server `host_name`. |\n\n*Note:* Any parameter passed in the query string will be passed to the action as a variable. Read more about it below.\n\n## Response\n\n```json\n{\n\t\"returncode\": 0,\n\t\"stderr\": \"Container test-app-api-1  Stopping\\nContainer test-app-api-1  Stopping\\nContainer test-app-api-1  Stopped\\nContainer test-app-api-1  Removing\\nContainer test-app-api-1  Removed\\nNetwork test-app_default  Removing\\nNetwork test-app_default  Removed\\n\",\n\t\"stdout\": \"\"\n}\n```\n\nThe field `returncode` indicates the status of the command, if it's zero: there were no errors, if it's greater than zero, there were errors.\n\nThe fields `stderr` `stdout` contains the output of the command. You may check them for debugging.\n\n## What is a service? Where are they?\n\nA service is a folder on your server that holds, usually a git repository.\n\nA service usually has a config for `pulling`, this action usually implies updating to the latest version available. An example would be a git pull.\n\nAnother action that a service can have is `deploy`, this action implies updating a service on the server to make it available. Usually implies either restarting some `systemd` service or using a container system such as `docker`.\n\nUltimately you as a developer can configure what actions and \n\n## How to define an actions file\n\nIn your service folder, the file `mypli.yml` is excepted.\n\nThis file looks like this:\n\n```yaml\npull:\n  - git pull origin main\n\ndeploy:\n  - docker compose down --volumes\n  - docker compose build --no-cache\n  - docker compose up -d\n```\n\nIn this case you can replace `pull` with any `action_name`, any command on the list **depends that former command executed correctly**. Any error will stop the pipeline.\n\nYou may define as many actions as you need.\n\n*Variables*\n\nYou can now define variables in your `mypli.yml` file, for example:\n\n```yaml\npull:\n  - git pull origin %var=branch%\n```\n\nThese variables are loaded from the Query parameters of the request. Make sure to define them in the request, otherwise the command will run with unexcepted results.\n\n## Set-up and configuration\n\nSetup environent config and secrets:\n\tcp .env.example .env\n\nEdit the `.env` file accordingly.\n\n| Variable | Description |\n| --- | --- |\n| `HOST` | The host the API listens to |\n| `PORT` | The port the API listens to |\n| `SECRET_KEY` | A password that you will have to send via a `KEY` header in the `HTTP` request |\n\nCreate an SSH key for the service.\n\nThis key will be used to connect to hosts, do not add a password to it, when asked for it just press return.\n\n\tmkdir -p cfg\n\tssh-keygen -t ed25519 -C \"api.lucdev.net Agent\" -f cfg/key\n\nWe need to generate the known_hosts file, for every domain the API will connect:\n\n\u003e ✏️ Do not copy paste! Replace those example domains (and ports) with your services.\n\n\tssh-keyscan -f cfg/key service-one.myself.tech \u003e\u003e cfg/known_hosts\n\tssh-keyscan -f cfg/key -p 2020 service-two.myself.tech  \u003e\u003e cfg/known_hosts\n\tssh-keyscan -f cfg/key -p 3050 service-three.myself.tech \u003e\u003e cfg/known_hosts\n\nIf the above commands don't work for some reason, then try connecting using:\n\n\tchmod 600 cfg/key\n\tssh -i cfg/key user@yourhost -p 3050 \n\nThen copy your `known_hosts`:\n\n\tcp ~/.ssh/known_hosts cfg/known_hosts\n\nDo not forget to add the key.pub to the server you are managing.\n\n## Build image and launch\n\n🐳 Use docker.\n\n\tdocker compose build --no-cache \u0026\u0026 docker compose up -d\n\t\n## 🛡️ Security advisory\n\nI am not an expert in software security, run this code in production at your own risk! If you find an exploit to my code **please** let me know, my email address is on my GitHub account.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucrnz%2Fmypli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucrnz%2Fmypli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucrnz%2Fmypli/lists"}