Sign inSign up

ifanfairuz/counter-server

By ifanfairuz

•Updated almost 2 years ago

Counter Server for handle ESP8266 counter device

Image
Integration & delivery
API management
Internet of things
0

172

ifanfairuz/counter-server repository overview

⁠Counter Server

Counter Server for handle ESP8266 counter device.

⁠Quick Start

⁠Before Start

Counter Server supported sheet integration (scheduled sync), to enable the feature you must connect to the google.
Get credentials.json (OAuth Credentials) from your Google Project see this tutorial https://developers.google.com/sheets/api/quickstart/go#authorize_credentials_for_a_desktop_application⁠ save your credentials.json and link to /credentials.json in container

⁠Files
.
├── credentials.json        # your OAuth Credential from Google
├── db-config.cnf           # db-config.cnf to add mariadb configuration
└── docker-compose.yml      # docker compose file (copy below)
⁠docker-compose.yml
version: "3.1"

services:
  app:
    image: ifanfairuz/counter-server:1.1
    restart: always
    ports:
      - 3000:8080
    environment:
      DB_HOST: db
      DB_PORT: 3306
      DB_USER: root
      DB_PASSWORD: root
      DB_NAME: counter
      TZ: Asia/Jakarta
    volumes:
      - ./credentials.json:/credentials.json
      - ./token.json:/token.json
    depends_on:
      db:
        condition: service_healthy
        restart: true

  db:
    image: mariadb:10.6
    restart: always
    ports:
      - 3306:3306
    environment:
      - MARIADB_DATABASE=counter
      - MYSQL_ROOT_PASSWORD=root
    volumes:
      - ./db-config.cnf:/etc/mysql/conf.d/custom-db-config.cnf
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      start_period: 2s
      interval: 10s
      timeout: 5s
      retries: 3

  phpmyadmin:
    image: phpmyadmin
    restart: always
    ports:
      - 8080:80
    environment:
      PMA_HOST: db

⁠Docker Run

docker run --restart=always \
--env DB_HOST=localhost \
--env DB_PORT=3306 \
--env DB_USER=root \
--env DB_PASSWORD=root \
--env DB_NAME=counter \
--env TZ=Asia/Jakarta \
-p 80:80 \
-v ./credentials.json:/credentials.json \
ifanfairuz/counter-server

⁠Enviroment Variables

⁠Database

DB_HOST - database host required.
DB_PORT - database port required.
DB_USER - database user required.
DB_PASSWORD - database password required.
DB_NAME - database name required.

⁠Time

TZ - timezone name, the name is taken to be a location name corresponding to a file in the IANA Time Zone database, such as "America/New_York" see https://pkg.go.dev/time#LoadLocation⁠

Tag summary

Content type

Image

Digest

sha256:6bdfc8ae8…

Size

45.2 MB

Last updated

almost 2 years ago

docker pull ifanfairuz/counter-server:1.1