Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .dev-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ services:
EXCLUDE_EXITED: $EXCLUDE_EXITED
PERIOD: $PERIOD
DISABLE_STARTUP_MSG: $DISABLE_STARTUP_MSG
SHA: 'false'
CUSTOM_NTFY_SERVER: $CUSTOM_NTFY_SERVER
NTFY_USER: $NTFY_USER
SHA: "false"
CUSTOM_NTFY_SERVER: $CUSTOM_NTFY_SERVER
NTFY_USER: $NTFY_USER
NTFY_PASS: $NTFY_PASS
NEWRELIC_API_KEY: ${NEWRELIC_API_KEY}
NEWRELIC_ENDPOINT: ${NEWRELIC_ENDPOINT}
ports:
- 1212:8000
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped


13 changes: 13 additions & 0 deletions .env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
NEWRELIC_API_KEY=
NEWRELIC_ENDPOINT=
MESSAGE_PLATFORM=
ONLY_OFFLINE_STATES=
EXCLUDE_EXITED=
SERVER_LABEL=
PERIOD=
DISABLE_STARTUP_MSG=
SERVER_AVATAR=
LABEL_ENABLE=
CUSTOM_NTFY_SERVER=
NTFY_USER=
NTFY_PASS=
80 changes: 56 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,66 @@
name: ci
name: Docker build to trigger manually based on workflow dispatch

env:
SERVICE_NAME: monocler-app # Update the service name to reflect your app's name
PROJECT_ID: dev-hachiai # Keep the project ID or update it if necessary
REPO_NAME: monocler-repo # Update the repository name to the new GCR repository name

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build from'
required: true
default: 'main'
tag:
description: 'Docker image tag (e.g., version, commit SHA, etc.)'
required: true
default: 'latest'

push:
branches:
- 'master'
- 'master' # Trigger on pushes to this specific branch

jobs:
docker:
build-and-push:
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }} # This will work for workflow_dispatch input

- name: Set up Node.js
uses: actions/setup-node@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v5
node-version: '16' # Use the Node.js version that matches your app

- name: Install dependencies
run: npm install --legacy-peer-deps

- name: Set up Google Cloud SDK
uses: google-github-actions/[email protected]
with:
context: .
push: true
platforms: linux/amd64,linux/arm64/v8
tags: petersem/monocker:latest
service_account_key: ${{ secrets.GOOGLE_CREDENTIALS }}
project_id: ${{ env.PROJECT_ID }}

- name: Authenticate Docker with Google Artifact Registry
run: gcloud --quiet auth configure-docker

- name: Prepare environment variables
run: echo "IMAGE_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV

- name: Build and tag Docker image
run: |
docker build --tag gcr.io/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}:latest .

- name: Push Docker image
run: |
docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}:latest

- name: Tag and push 'latest' image
if: ${{ github.event.inputs.tag != 'latest' }}
run: |
docker tag gcr.io/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}:latest gcr.io/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}:latest
docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}:latest
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ignore the following folders
node_modules/*
node_modules
.env
# any excluded dir with a .keep file. Will stay in github, but all other files will not :)
!.keep

indexWithCurl.js
18 changes: 18 additions & 0 deletions .local-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.2"

services:
monocker:
container_name: monocker
image: petersem/monocker
environment:
MESSAGE_PLATFORM: ${MESSAGE_PLATFORM}
ONLY_OFFLINE_STATES: ${ONLY_OFFLINE_STATES}
EXCLUDE_EXITED: ${EXCLUDE_EXITED}
SERVER_LABEL: ${SERVER_LABEL}
PERIOD: ${PERIOD}
DISABLE_STARTUP_MSG: ${DISABLE_STARTUP_MSG}
NEWRELIC_API_KEY: ${NEWRELIC_API_KEY}
NEWRELIC_ENDPOINT: ${NEWRELIC_ENDPOINT}
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
restart: unless-stopped
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ WORKDIR /app

EXPOSE 8000
HEALTHCHECK --interval=10s --timeout=5s --retries=3 --start-period=5s CMD wget --spider http://localhost:8000/status > /dev/null || exit 1
CMD ["node", "index.js"]
CMD ["node", "index.js"]

22 changes: 10 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ services:
dockerfile: ./Dockerfile
environment:
# Optional label to preface messages. Handy if you are running multiple versions of Monocker
SERVER_LABEL: 'Dev'
SERVER_LABEL: "Dev"
# Optional avatar image URL to add to messages. Handy if you are running Monocker on different machines
# -> ONLY supported by discord, slack & ntfy
SERVER_AVATAR: 'https://content.invisioncic.com/u329766/monthly_2024_05/monocker.png.ba5ffdb390b627097d2a53645cf87350.png'
SERVER_AVATAR: "https://content.invisioncic.com/u329766/monthly_2024_05/monocker.png.ba5ffdb390b627097d2a53645cf87350.png"
# [Optional] - Set this value to a docker socket URL, if you want to connect to docker this way. Leave it blank or omit it otherwise
# DOCKER_HOST: 'tcp://192.168.1.134:2375'

# Specify the messaging platform and details, or leave blank if only wanting container logs (pick one only)
# MESSAGE_PLATFORM: 'telegram@your_bot_id@your_chat_id'
# MESSAGE_PLATFORM: 'pushbullet@your_api_key@your_device_id'
# MESSAGE_PLATFORM: 'pushover@your_user_key@your_app_api_token'
MESSAGE_PLATFORM: 'discord@webhook_url'
MESSAGE_PLATFORM: "discord@webhook_url"
# MESSAGE_PLATFORM = apprise@apprise_url@config_id@tag
# MESSAGE_PLATFORM: 'gotify@server@app_token'
# MESSAGE_PLATFORM: 'ntfy@topic_title'
Expand All @@ -30,22 +30,20 @@ services:
# Optional - includes or excludes specified containers - default behaviour is false
# If missing or set to false (default), any containers with a "monocker.enable: 'false'" label will be excluded, and all others monitored.
# If set to true, only containers with a "monocker.enable: 'true'" label will be included.
LABEL_ENABLE: 'false'
LABEL_ENABLE: "false"
# Optional - only show when container state changes to being offline (paused, exited, running (unhealthy), or dead) - default is false
ONLY_OFFLINE_STATES: 'false'
ONLY_OFFLINE_STATES: "false"
# [Optional] - Regardless of any other settings, you can ignore or include 'exited'
EXCLUDE_EXITED: 'false'
# [Optional] - Set the poll period in seconds. Defaults to 10 seconds, which is also the minimum.
EXCLUDE_EXITED: "false"
# [Optional] - Set the poll period in seconds. Defaults to 10 seconds, which is also the minimum.
PERIOD: 30
# [Optional] - Suppress startup messages from being sent. Default is false
DISABLE_STARTUP_MSG: 'false'
DISABLE_STARTUP_MSG: "false"

## ADVANCED NTFY SETTINGS
# CUSTOM_NTFY_SERVER: 'https://ntfy.yourdomain.net' # use your own NTFY server
# NTFY_USER: 'user' # use a username and password to login (on ntfy.sh or your own server)
# NTFY_PASS: 'psw'
# NTFY_PASS: 'psw'
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped


Loading