Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

various Fixes #167

Merged
merged 10 commits into from
Oct 17, 2023
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
4 changes: 4 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Devcontainer readme
This directory allows you to develop your adapter in a dedicated Docker container. To get started and for requirements, please read the getting started section at https://code.visualstudio.com/docs/remote/containers#_getting-started

Once you're done with that, VSCode will prompt you to reopen the adapter directory in a container. This takes a while, afterwards you can access the admin UI at http://localhost:8082. To change that port, edit `docker-compose.yml` to have a different `ports` configuration for `nginx`.
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.101.1/containers/docker-existing-docker-compose
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
{
"name": "ioBroker Docker Compose",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [ "docker-compose.yml" ],

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "iobroker",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspace",

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": ["dbaeumer.vscode-eslint"],

// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],

// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",

// When creating the container, delete unnecessary adapters, disable error reporting, set the license as confirmed, and install/update this adapter
"postCreateCommand": "iob del discovery && iob plugin disable sentry && iob object set system.config common.licenseConfirmed=true && NPM_PACK=$(npm pack) && iob url \"$(pwd)/$NPM_PACK\" --debug && rm \"$NPM_PACK\""

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
//"remoteUser": "iobroker"
}
40 changes: 40 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3'

services:
iobroker:
build: ./iobroker
container_name: iobroker-esphome
hostname: iobroker-esphome
# This port is only internal, so we can work on this while another instance of ioBroker is running on the host
expose:
- 8081
# manual direct expose when proxy is weird for some reason...
ports:
- 8083:8081
volumes:
- ..:/workspace:cached
- iobrokerdata-esphome:/opt/iobroker
environment:
- LANG=en_US.UTF-8
- LANGUAGE=en_US:en
- LC_ALL=en_US.UTF-8
- TZ=Europe/Berlin
- SETGID=1000

# Reverse proxy to load up-to-date admin sources from the repo
nginx:
image: nginx:latest
depends_on:
- iobroker
links:
- iobroker
container_name: nginx-esphome
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ..:/workspace:cached
ports:
# Make the ioBroker admin available under http://localhost:8082
- 8082:80

volumes:
iobrokerdata-esphome:
2 changes: 2 additions & 0 deletions .devcontainer/iobroker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM iobroker/iobroker:latest
RUN ln -s /opt/iobroker/node_modules/ /root/.node_modules
28 changes: 28 additions & 0 deletions .devcontainer/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
worker_processes 1;
events { worker_connections 1024; }

http {
sendfile on;
keepalive_timeout 65;

server {
listen 80;

location / {
proxy_redirect off;
proxy_pass http://iobroker:8081;
}

location /socket.io/ {
proxy_pass http://iobroker:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

location /adapter/esphome/ {
alias /workspace/admin/;
}

}
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gulpfile.js
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
]
},
"parserOptions": {
"ecmaVersion": 2018
"ecmaVersion": "latest"
}
}
6 changes: 3 additions & 3 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- name: Checkout code
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- name: Checkout code
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ Thumbs.db

# i18n intermediate files
admin/i18n/flat.txt
admin/i18n/*/flat.txt
admin/i18n/*/flat.txt

# ioBroker dev-server
.dev-server/

# python venv
env/
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ All our adapter documentation can be found at [The DrozmotiX Docu Page](https://

## Prerequisites

* NodeJS >= 12.x
* Python >=3.7, <4.0
* NodeJS >= 18.x
* API is activated in YAML
* For admin tabs (optional)
* ESPHome Dashboard IP is provided in instance settings
Expand Down
Loading
Loading