Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#GitHub environment
GITHUB_URL=github.com/dockopslab/bulckan.git
GITHUB_BRANCH=example/bulckan-target
GITHUB_URL=github.com/dockopslab/pulseops.git
GITHUB_BRANCH=example/pulseops-target
GITHUB_PATH=sample/
CHECK_INTERVAL=60
GITHUB_USERNAME=
GITHUB_TOKEN=
GITHUB_TOKEN=
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: bulckanCI
name: pulseopsCI

on:
push:
Expand All @@ -12,7 +12,7 @@ on:
paths:
- 'app/**'
jobs:
build-bulckanCI:
build-pulseopsCI:
runs-on: ubuntu-latest

steps:
Expand All @@ -34,4 +34,4 @@ jobs:
with:
context: ./app
push: true
tags: ghcr.io/${{ github.repository_owner }}/bulckan:latest
tags: ghcr.io/${{ github.repository_owner }}/pulseops:latest
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.record/

# Files
bulckan_test.sh
pulseops_test.sh
.test.env
compose.test.yml
Dockerfile.test
Dockerfile.test
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
[![bulckanCI](https://github.com/dockopslab/bulckan/actions/workflows/bulckanCI.yml/badge.svg?branch=main)](https://github.com/dockopslab/bulckan/actions/workflows/bulckanCI.yml)
![GitHub License](https://img.shields.io/github/license/dockopslab/bulckan)
[![pulseopsCI](https://github.com/dockopslab/pulseops/actions/workflows/pulseopsCI.yml/badge.svg?branch=main)](https://github.com/dockopslab/pulseops/actions/workflows/pulseopsCI.yml)
![GitHub License](https://img.shields.io/github/license/dockopslab/pulseops)


# bulckan
# PulseOps

This project provides a GitOps tool for Docker Compose on a Docker container.

The application clones a GitHub repository, periodically checks for changes to a specific branch and path, and deploys or updates the project using Docker Compose.

At the end of each time interval, in addition to checking for changes and updating the deployment, it re-runs the initial command so that if a service has been removed, it is redeployed while maintaining parity between the deployment on the host and the compose files on Github.

bulckan will show in the logs all the steps to deploy the compose file. It will also store and log the name specified in compose, the last commit that forced the deployment or update on the host, and the number of times it has been updated due to changes on GitHub.
PulseOps will show in the logs all the steps to deploy the compose file. It will also store and log the name specified in compose, the last commit that forced the deployment or update on the host, and the number of times it has been updated due to changes on GitHub.

## Requirements:
- Docker
- Docker Compose
- Access to a GitHub repository (public or private)

bulckan only monitors changes in the specified path and will only update the configuration of the docker compose file. It does not monitor if the images have been updated, use [Watchtower](https://containrrr.dev/watchtower/?ref=selfh.st) for that by deploying it with bulckan or implement a workflow that changes the image version in the compose when the image is rebuilt.
PulseOps only monitors changes in the specified path and will only update the configuration of the docker compose file. It does not monitor if the images have been updated, use [Watchtower](https://containrrr.dev/watchtower/?ref=selfh.st) for that by deploying it with PulseOps or implement a workflow that changes the image version in the compose when the image is rebuilt.

Note: To test the functionality, it is possible to deploy bulckan as configured. The application points to a branch of the same repository that contains the [compose files](https://github.com/dockopslab/bulckan/tree/example/bulckan-target) needed to deploy one or more Apache containers.
Note: To test the functionality, it is possible to deploy PulseOps as configured. The application points to a branch of the same repository that contains the [compose files](https://github.com/dockopslab/pulseops/tree/example/pulseops-target) needed to deploy one or more Apache containers.

## Configuration
First, clone this repository and navigate to the project directory:

```
git clone https://github.com/dockopslab/bulckan.git
cd bulckan
git clone https://github.com/dockopslab/pulseops.git
cd pulseops
```

Configure the ``.env`` file to access the repository, branch and path where the compose file you want to deploy and maintain with this tool is located:

```
GITHUB_URL=github.com/dockopslab/bulckan.git
GITHUB_BRANCH=example/bulckan-target
GITHUB_URL=github.com/dockopslab/pulseops.git
GITHUB_BRANCH=example/pulseops-target
GITHUB_PATH=sample/
CHECK_INTERVAL=60
GITHUB_USERNAME=
GITHUB_TOKEN=
```
Bulckan deployment:
PulseOps deployment:

```
docker compose up -d
Expand All @@ -54,7 +54,7 @@ rm: can't remove 'repo': Resource busy
Cloning into 'repo'...
Recording update...
Deploying with docker-compose...
Compose name: 'bulckan-test1'
Compose name: 'pulseops-test1'
Last deployed commit: 3ee4dfad909302af3e7561a2877ac1addfc0119d
Total updates: 1
apache2 Pulling
Expand Down Expand Up @@ -88,19 +88,19 @@ Total updates: 1
Sleeping for 60 seconds...
```

By adding the following tags to the target application's compose file, information tags will be set on the containers with the commit that forced the last deployment and the number of updates bulckan has performed to maintain parity:
By adding the following tags to the target application's compose file, information tags will be set on the containers with the commit that forced the last deployment and the number of updates PulseOps has performed to maintain parity:

```
labels:
- "bulckan.deploy.update_count=${UPDATE_COUNT}"
- "bulckan.deploy.last_commit=${LAST_COMMIT}"
- "pulseops.deploy.update_count=${UPDATE_COUNT}"
- "pulseops.deploy.last_commit=${LAST_COMMIT}"
```

See an example in this [compose file](https://github.com/dockopslab/bulckan/blob/example/bulckan-target/sample/docker-compose.yml).
See an example in this [compose file](https://github.com/dockopslab/pulseops/blob/example/pulseops-target/sample/docker-compose.yml).

# Multiple deployment configuration

bulckan can be deployed multiple times, so it can point to different repositories and keep different applications updated and deployed at the same time.
PulseOps can be deployed multiple times, so it can point to different repositories and keep different applications updated and deployed at the same time.

If necessary, configure the ``.git.env`` file:
```
Expand All @@ -110,36 +110,36 @@ GITHUB_TOKEN=

Configure environment variables in ``compose.example.yml``:
```
name: 'bulckan-example'
name: 'pulseops-example'

networks:
bulckan:
pulseops:

volumes:
repo1:
repo2:
repo3:

services:
bulckan1:
image: ghcr.io/dockopslab/bulckan:latest
pulseops1:
image: ghcr.io/dockopslab/pulseops:latest
env_file:
- .git.env
environment:
- GITHUB_URL=github.com/dockopslab/bulckan.git
- GITHUB_BRANCH=example/bulckan-target
- GITHUB_URL=github.com/dockopslab/pulseops.git
- GITHUB_BRANCH=example/pulseops-target
- GITHUB_PATH=watchtower/
- CHECK_INTERVAL=3600
volumes:
- /var/run/docker.sock:/var/run/docker.sock

bulckan2:
image: ghcr.io/dockopslab/bulckan:latest
pulseops2:
image: ghcr.io/dockopslab/pulseops:latest
env_file:
- .git.env
environment:
- GITHUB_URL=github.com/dockopslab/bulckan.git
- GITHUB_BRANCH=example/bulckan-target
- GITHUB_URL=github.com/dockopslab/pulseops.git
- GITHUB_BRANCH=example/pulseops-target
- GITHUB_PATH=sample/
- CHECK_INTERVAL=120
volumes:
Expand All @@ -148,13 +148,13 @@ services:
....
```

bulckan deployment:
PulseOps deployment:

```
docker-compose -f compose.example.yml up -d
```

Note: Before deploying multiple docker-compose.yml with Bulckan, it is necessary to check for possible incompatibilities. Errors due to duplication of exposed ports, service names, networks, and others must be corrected before deployment.
Note: Before deploying multiple docker-compose.yml with PulseOps, it is necessary to check for possible incompatibilities. Errors due to duplication of exposed ports, service names, networks, and others must be corrected before deployment.

## Contributions
Contributions are welcome. Please open an issue or send a pull request to improve this project.
Expand Down
6 changes: 3 additions & 3 deletions app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ RUN apk --no-cache add \
rm -rf /var/cache/apk/* /tmp/*

# Copy the deployment script to the container
COPY bulckan.sh /usr/local/bin/bulckan.sh
COPY pulseops.sh /usr/local/bin/pulseops.sh

# Give execution permissions to the script
RUN chmod +x /usr/local/bin/bulckan.sh
RUN chmod +x /usr/local/bin/pulseops.sh

ENTRYPOINT ["/usr/local/bin/bulckan.sh"]
ENTRYPOINT ["/usr/local/bin/pulseops.sh"]
File renamed without changes.
36 changes: 18 additions & 18 deletions compose.example.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
name: 'bulckan-example'
name: 'pulseops-example'

networks:
bulckan:
pulseops:

volumes:
repo1:
repo2:
repo3:

services:
bulckan1:
image: ghcr.io/dockopslab/bulckan:latest
pulseops1:
image: ghcr.io/dockopslab/pulseops:latest
env_file:
- .git.env
environment:
- GITHUB_URL=github.com/dockopslab/bulckan.git
- GITHUB_BRANCH=example/bulckan-target
- GITHUB_URL=github.com/dockopslab/pulseops.git
- GITHUB_BRANCH=example/pulseops-target
- GITHUB_PATH=watchtower/
- CHECK_INTERVAL=3600
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- repo1:/repo
# - .repo1:/repo
networks:
- bulckan
- pulseops

bulckan2:
image: ghcr.io/dockopslab/bulckan:latest
pulseops2:
image: ghcr.io/dockopslab/pulseops:latest
env_file:
- .git.env
environment:
- GITHUB_URL=github.com/dockopslab/bulckan.git
- GITHUB_BRANCH=example/bulckan-target
- GITHUB_URL=github.com/dockopslab/pulseops.git
- GITHUB_BRANCH=example/pulseops-target
- GITHUB_PATH=sample/
- CHECK_INTERVAL=120
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- repo2:/repo
# - .repo2:/repo
networks:
- bulckan
- pulseops

bulckan3:
image: ghcr.io/dockopslab/bulckan:latest
pulseops3:
image: ghcr.io/dockopslab/pulseops:latest
env_file:
- .git.env
environment:
- GITHUB_URL=github.com/dockopslab/bulckan.git
- GITHUB_BRANCH=example/bulckan-target
- GITHUB_URL=github.com/dockopslab/pulseops.git
- GITHUB_BRANCH=example/pulseops-target
- GITHUB_PATH=sample1/
- CHECK_INTERVAL=60
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- repo3:/repo
# - .repo3:/repo
networks:
- bulckan
- pulseops

# ...
# ...
10 changes: 5 additions & 5 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: 'bulckan'
name: 'pulseops'

networks:
bulckan:
pulseops:

volumes:
repo:

services:
bulckan1:
image: ghcr.io/dockopslab/bulckan:latest
pulseops1:
image: ghcr.io/dockopslab/pulseops:latest
environment:
- GITHUB_URL=${GITHUB_URL}
- GITHUB_BRANCH=${GITHUB_BRANCH}
Expand All @@ -21,4 +21,4 @@ services:
- repo:/repo
# - .repo:/repo
networks:
- bulckan
- pulseops