Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrspartak/swarmpit-ci-deploy
Simple Swarmpit API tool to redeploy services by name using HTTP request
https://github.com/mrspartak/swarmpit-ci-deploy
autodeploy ci deploy deployment deployment-automation docker docker-compose docker-image docker-swarm dockerfile github-actions gitlab gitlab-ci swarm swarmpit
Last synced: 10 days ago
JSON representation
Simple Swarmpit API tool to redeploy services by name using HTTP request
- Host: GitHub
- URL: https://github.com/mrspartak/swarmpit-ci-deploy
- Owner: mrspartak
- License: mit
- Created: 2020-03-13T16:15:51.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-27T16:33:50.000Z (almost 2 years ago)
- Last Synced: 2025-02-06T14:08:40.006Z (14 days ago)
- Topics: autodeploy, ci, deploy, deployment, deployment-automation, docker, docker-compose, docker-image, docker-swarm, dockerfile, github-actions, gitlab, gitlab-ci, swarm, swarmpit
- Language: JavaScript
- Homepage:
- Size: 142 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple [Swarmpit](https://github.com/swarmpit/swarmpit) API tool to redeploy services by name
I made this app because Swarmpit can't update services from private repositories, so I can use it in CI "deploy" stage via curl.[](https://app.codacy.com/manual/assorium/swarmpit-ci-deploy)
[](https://hub.docker.com/r/assorium/swarmpit-ci-deploy "Docker Cloud Automated build")
[](https://hub.docker.com/r/assorium/swarmpit-ci-deploy "Docker Cloud Build Status")
[](https://hub.docker.com/r/assorium/swarmpit-ci-deploy "Docker Pulls")[](https://github.com/mrspartak/swarmpit-ci-deploy/releases "Latest Github tag")
## Environment variables
#port app will be launched at
const APP_PORT = process.env.APP_PORT || 3052
const APP_KEY = process.env.APP_KEY
key query to protect direct access
You can also pass key via APP_KEY_CONFIG or APP_KEY_SECRET (docker config or secret file)#Debug
const DEBUG = process.env.DEBUG || false;#Swarmpit settings
const SWARMPIT_URL = process.env.SWARMPIT_URL || 'http://127.0.0.1:888';const SWARMPIT_AUTH = process.env.SWARMPIT_AUTH
this is Bearer token, it could be obtained in Swampit > Profile Settings > API Access
You can also pass this token via SWARMPIT_AUTH_CONFIG or SWARMPIT_AUTH_SECRET (docker config or secret file)## Docker
you can use config or secret file
```
docker config create swarmpit_token "Beared gihrogio..." or you can just add local file with volumedocker run -p 3050:3050 --name swarmpit-ci-deploy \
-e APP_KEY=123 -e SWARMPIT_AUTH_CONFIG=swarmpit_token \
--config src=swarmpit_token,target="/home/app/tracker.txt" \
assorium/swarmpit-ci-deploy:latest
```## Usage
Redeployment. Service will try to download latest image and will restart.
```
GET /redeploy
query:
name: serviceName
id: id of serviceRETURNS JSON
{success: Boolean, error?}//example
GET /redeploy?key={key}&name=frontend-app
```Example with .gitlab-ci.yml
"apk add --update curl && rm -rf /var/cache/apk/*" you need this if you use docker:dind
```yml
deploy:
stage: deploy
before_script:
- apk add --update curl && rm -rf /var/cache/apk/*
script:
- curl "${DEPLOY_URL}/redeploy?key=${DEPLOY_KEY}&name=${DEPLOY_NAME}"
only:
- master
```
DEPLOY_URL - URL of this service, for example http://123.123.123.123:3052
DEPLOY_KEY - IS AN APP_KEY variable
DEPLOY_NAME - name of service you need to update## TODO
* Of course I can implement webhook support. Write down an issue if you need this
* Maybe other stuff, like upscale or downscale service by name