Skip to content

Commit

Permalink
Merge pull request #49 from MedAziz11/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MedAziz11 authored Aug 10, 2023
2 parents facfceb + 93c5694 commit a195e62
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 46 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ jobs:

# Set up Docker Buildx for building images with BuildKit
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

# Cache Docker layers for faster builds
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-buildx-${{ github.ref }}-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-${{ github.ref }}-
${{ runner.os }}-buildx-
# - name: Cache Docker layers
# uses: actions/cache@v3
# with:
# path: ${{ env.CACHE_PATH }}
# key: ${{ runner.os }}-buildx-${{ github.ref }}-${{ hashFiles('**/Dockerfile') }}
# restore-keys: |
# ${{ runner.os }}-buildx-${{ github.ref }}-
# ${{ runner.os }}-buildx-

# Log in to Docker Hub using the provided secrets
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Expand All @@ -69,18 +69,19 @@ jobs:
echo "Error: Unexpected branch or tag"
exit 1
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "::set-output name=tags::${TAGS}"
# Build, test, and push the Docker image
- name: Build, Test, and Push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.image_tags.outputs.tags }}
cache-from: type=local,src=${{ env.CACHE_PATH }}
# cache-from: type=local,src=${{ env.CACHE_PATH }}
cache-to: type=local,dest=${{ env.CACHE_PATH }}

# FUTURE TESTS?
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ RUN addgroup -S appgroup && adduser -S appuser -G appgroup -s /bin/sh
# Copy Python packages and the virtual environment from the builder stage
COPY --from=builder --chown=appuser:appgroup /app /app

# Create /db directory to prevent permission issues
RUN mkdir /db && \
chown appuser:appgroup /db

# Set the working directory to /app
WORKDIR /app

Expand Down
66 changes: 37 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@

### Environment Variables :

#### Required
You have to define these ENV VARS in order to connect to your KUMA server.

KUMA_SERVER=<your_kuma_server>
KUMA_USERNAME=<your_kuma_username>
KUMA_PASSWORD=<your_kuma_password>
ADMIN_PASSWORD=<your admin password so you can connect with via the api>
KUMA_SERVER: The URL of your Uptime Kuma instance. ex: https://uptime.example.com
KUMA_USERNAME: The username of your Uptime Kuma user
KUMA_PASSWORD: The password of your Uptime Kuma user
ADMIN_PASSWORD: An admin password to access the API

#### Optional
Additional configuration variables available

ACCESS_TOKEN_EXPIRATION: Minutes the access token should be valid. Defaults to 8 days.
SECRET_KEY: A secret value to encode JWTs with

#### Note:

Expand All @@ -46,33 +53,34 @@ You can simply create a docker compose file like this :
```yaml
version: "3.9"
services:
kuma:
container_name: uptime-kuma
image: louislam/uptime-kuma:latest
ports:
- "3001:3001"
restart: always
volumes:
- uptime-kuma:/app/data

api:
container_name: backend
image: medaziz11/uptimekuma_restapi
volumes:
- ./db:/db
restart: always
environment:
- KUMA_SERVER=http://kuma:3001
- KUMA_USERNAME=test
- KUMA_PASSWORD=123test.
- ADMIN_PASSWORD=admin
depends_on:
- kuma
ports:
- "8000:8000"
kuma:
container_name: uptime-kuma
image: louislam/uptime-kuma:latest
ports:
- "3001:3001"
restart: always
volumes:
- uptime-kuma:/app/data

api:
container_name: backend
image: medaziz11/uptimekuma_restapi
volumes:
- api:/db
restart: always
environment:
- KUMA_SERVER=http://kuma:3001
- KUMA_USERNAME=test
- KUMA_PASSWORD=123test.
- ADMIN_PASSWORD=admin
depends_on:
- kuma
ports:
- "8000:8000"

volumes:
uptime-kuma:
uptime-kuma:
api:
```
### In order for the example to work: You have to run kuma first then create your kuma username and password then re-run the compose file.
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
build: .
# image: medaziz11/uptimekuma_restapi:1.2
volumes:
- ./db:/db:rwx
- api:/db
restart: always
environment:
- KUMA_SERVER=${KUMA_SERVER:-http://kuma:3001}
Expand All @@ -26,4 +26,4 @@ services:

volumes:
uptime-kuma:
api-db:
api:
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ python-engineio==4.3.4
python-multipart==0.0.5
python-socketio==5.7.1
pytz==2022.4
PyYAML==6.0
pyyaml!=6.0.0,!=5.4.0,!=5.4.1
requests==2.28.1
six==1.16.0
sniffio==1.3.0
Expand All @@ -36,4 +36,4 @@ websocket-client==1.4.1
websockets==10.3
asyncio==3.4.3
gunicorn==20.1.0
uvicorn==0.21.1
uvicorn==0.21.1

0 comments on commit a195e62

Please sign in to comment.