From 93c16c4c37a7587ddb69dcd84412a95fe6d0e8bb Mon Sep 17 00:00:00 2001 From: fedy95 Date: Sun, 11 Apr 2021 06:13:45 +0300 Subject: [PATCH] update-deploy --- .drone.yml | 6 +++++- LICENSE | 19 +++++++++++++++++++ Makefile | 12 +++++++----- README.md | 7 ++++--- docker-compose.yml | 42 +++++++++++++++++++++--------------------- 5 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 LICENSE diff --git a/.drone.yml b/.drone.yml index 1017140..44a1eb3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -45,12 +45,16 @@ server: from_secret: password steps: - - name: release + - name: deploy commands: - cd /mnt/md0/infra/homeassistant - git pull - make restart - make check + - name: cleanup + commands: + - cd /mnt/md0/infra/homeassistant + - make cleanup trigger: branch: diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b195b12 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +MIT License Copyright (c) 2021 fedy95 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile index 3c5ab02..87b7cc6 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,15 @@ lint-json: docker pull ${REGISTRY}/${JSONLINT_TAG} $(LINT-JSON-CMD) -qc etc/config/custom_components/circadian_lighting/manifest.json -restart: down start -start: - docker-compose -f docker-compose.yml up -d -down: - docker-compose -f docker-compose.yml down +restart: + docker-compose -f docker-compose.yml pull + docker-compose -f docker-compose.yml restart check: docker exec homeassistant_instance python -m homeassistant --script check_config --config /config +cleanup: + docker system prune --all --force + docker system prune --volumes --force + .DEFAULT_GOAL := lint diff --git a/README.md b/README.md index 2514e4e..cd28ea0 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -### homeassistant -[![Build Status](https://drone.fedy95.com/api/badges/infra/homeassistant/status.svg)](https://drone.fedy95.com/infra/homeassistant) +### homeassistant [![Build Status](https://drone.fedy95.com/api/badges/infra/homeassistant/status.svg)](https://drone.fedy95.com/infra/homeassistant) + +--- ## services - [docker hub](https://hub.docker.com/r/homeassistant/home-assistant) - [docs](https://www.home-assistant.io/) -## example +## example - https://github.com/arsaboo/homeassistant-config diff --git a/docker-compose.yml b/docker-compose.yml index 433060b..f9838be 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,30 +2,30 @@ version: "3" services: - homeassistant_instance: - image: homeassistant/home-assistant:2021.2.3 - container_name: homeassistant_instance - hostname: homeassistant_instance - restart: always - depends_on: - - homeassistant_db + homeassistant_instance: + image: homeassistant/home-assistant:2021.2.3 + container_name: homeassistant_instance + hostname: homeassistant_instance + restart: always + depends_on: + - homeassistant_db - volumes: - - /etc/localtime:/etc/localtime:ro - - ./etc/config:/config + volumes: + - /etc/localtime:/etc/localtime:ro + - ./etc/config:/config - ports: - - "8123:8123" - homeassistant_db: - image: mariadb:10.5 - container_name: homeassistant_db + ports: + - "8123:8123" + homeassistant_db: + image: mariadb:10.5 + container_name: homeassistant_db - hostname: homeassistant_db - restart: unless-stopped + hostname: homeassistant_db + restart: unless-stopped - env_file: - - ./.env-homeassistant_db + env_file: + - ./.env-homeassistant_db - volumes: - - ./etc/homeassistant_db/data:/var/lib/mysql + volumes: + - ./etc/homeassistant_db/data:/var/lib/mysql ...