Giter Club home page Giter Club logo

dev-portal's Introduction

ioBroker Developer Portal

This repository contains all code used in the ioBroker Developer Portal at https://www.iobroker.dev

Screenshot

Development

Setup

To install the application you can run npm install in these directories:

  • ./express/frontend
  • ./express/backend

Build

To build the application you can run npm build in these directories:

  • ./express/frontend
  • ./express/backend

Hot-reload on code changes

You may also use hot-reload of both the backend and frontend code. For this, you can start each applications with the respective command:

Note: running the backend in watch mode will not use the frontend in hot-reload!

Running docker-compose (DEV)

These instructions are only for development. DO NOT USE THIS IN A PRODUCTION ENVIRONMENT!

  1. Create the two required Github OAuth apps in your account - see below

  2. Create a file called docker-compose.override.yml in this root directory and configure all environment variables and the port to expose:

version: "3"
services:
    express:
        build: express
        ports:
            - "8080:8080"
        environment:
            ALLOW_CORS: 1
            PORTAL_GITHUB_OAUTH_CLIENT_ID: 1234567890abcdefghij
            PORTAL_GITHUB_OAUTH_CLIENT_SECRET: 123456e0a66c140657890abcdefghij7236c1406
            CREATOR_GITHUB_OAUTH_CLIENT_ID: abcdefghij1234567890
            CREATOR_GITHUB_OAUTH_CLIENT_SECRET: abcdefghij7236c1406123456e0a66c140657890
            WEBLATE_ACCESS_TOKEN: AbCdEfGhIjKlMnOpQrStUvWxYz0123456789aBcD
            SENTRY_AUTH_TOKEN: 01234567890abcdefghij7236c1406123456e0a66c140657890abcef01234567
    watchtower:
        command: none
    mongo-express:
        image: "mongo-express:latest"
        restart: always
        ports:
            - "8088:8081"
  1. In this root directory call docker-compose pull && docker-compose up --build

Deployment

The orchestration is done using docker-compose.

The docker image of the express application is hosted on GitHub, for this you need to login once with docker to the registry:

docker login docker.pkg.github.com

As the password you must use a personal access token for your GitHub account.

Running the server (PROD)

  1. Create a file called docker-compose.override.yml in this root directory and configure all environment variables and the port to expose:
version: "3"
services:
    express:
        ports:
            - "80:8080"
        environment:
            PORTAL_GITHUB_OAUTH_CLIENT_ID: 1234567890abcdefghij
            PORTAL_GITHUB_OAUTH_CLIENT_SECRET: 123456e0a66c140657890abcdefghij7236c1406
            CREATOR_GITHUB_OAUTH_CLIENT_ID: abcdefghij1234567890
            CREATOR_GITHUB_OAUTH_CLIENT_SECRET: abcdefghij7236c1406123456e0a66c140657890
            WEBLATE_ACCESS_TOKEN: AbCdEfGhIjKlMnOpQrStUvWxYz0123456789aBcD
            SENTRY_AUTH_TOKEN: 01234567890abcdefghij7236c1406123456e0a66c140657890abcef01234567
    watchtower:
        environment:
            REPO_USER: "YourGitHubUserName"
            REPO_PASS: "<personal access token (see above)>"
  1. In this root directory call docker-compose pull && docker-compose up

Environment variables

The following environment variables can be configured:

  • ALLOW_CORS: Allows the server to be accessed from another host (should only be used for development)
  • PORTAL_GITHUB_OAUTH_CLIENT_ID: GitHub Client ID of your OAuth App that is used for general portal login (see below)
  • PORTAL_GITHUB_OAUTH_CLIENT_SECRET: Client secret belonging to the above OAuth App
  • CREATOR_GITHUB_OAUTH_CLIENT_ID: GitHub Client ID of your OAuth App that is used to create and modify repositories (see below)
  • CREATOR_GITHUB_OAUTH_CLIENT_SECRET: Client secret belonging to the above OAuth App
  • WEBLATE_ACCESS_TOKEN: Access token for a read-only Weblate user
  • SENTRY_AUTH_TOKEN: Auth token for Sentry (requires org:read and project:read scopes)

GitHub OAuth Apps

Two OAuth Apps are required to run this server:

  • The general portal login application will always only ask for public data (and the e-mail address) and is used to authenticate the user, find his GitHub repositories and other publicly available information. The e-mail address might be used at a later time to send information about ioBroker development to the user (after consent!). The scope the OAuth request is user:email.
  • Adapter Creator application will ask the user for much more permissons than the portal OAuth app. It is used to create repositories using the Adapter Creator and allow to modify code from this application. No interaction with the repository will ever be made without the user consenting at the given moment (there are no overnight jobs or anything like that). The scope the OAuth request is repo.

Both applications must point to https://<your-server>/auth/ as the Authorization callback URL. For development this URL might be something like http://localhost:8080/auth/.

Optional: Google Translate Credentials

If you wish to use the Google Translate V3 API, you can provide valid credentials in a file called google-translate-credentials.json, so the Adapter Creator application can use larger quota for translations (which may result in costs).

For DEV, you can put it into the directory ./express/backend. The file will be copied by docker-compose into the express container and will be available to the web server.

For PROD, you can put it into the root directory of the project and then add the following volume to the express service in your docker-compose.override.yml:

        volumes:
            - ${PWD}/google-translate-credentials.json:/app/google-translate-credentials.json

The file can be generated on the Google Cloud Platform by creating a Service Account for Google Translate V3. See here for additional information. The expected format looks something like this:

{
	"type": "service_account",
	"project_id": "your-project-id-123456",
	"private_key_id": "1234567890abcdef1234567890abcdef12345678",
	"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
	"client_email": "[email protected]",
	"client_id": "123456789012345678901",
	"auth_uri": "https://accounts.google.com/o/oauth2/auth",
	"token_uri": "https://oauth2.googleapis.com/token",
	"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
	"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-app-name%40your-project-id-123456.iam.gserviceaccount.com"
}

Attributions

dev-portal's People

Contributors

alcalzone avatar apollon77 avatar germanbluefox avatar lgtm-migrator avatar unclesamswiss avatar xxbjxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dev-portal's Issues

Add link to Sentry

If possible, it would be nice to have on the adapter cards a direct link to the Sentry project dashboard if Sentry is enabled in an adapter.

301 Redirect for iobroker.dev

The application should redirect from https://iobroker.dev/ to https://www.iobroker.dev/ with a status code 301.

This is needed as we can only use an IP address for the root DNS A entry, thus if the IP address changes, we need to update the DNS manually (contrary to the CNAME record used for www which points to the hosting server which will be updated automatically on IP address change).

Adapter transfer assistant

Part 1 of the Assistant, become a member:
Before a developer can transfer an adapter he has to be member of the community org on Github and npmjs.com.

  1. Request memebership
  2. Enter name for npmjs.com
  3. Enter telegram/discord name and/or email. One of them has to be given for getting in contact with the developer.
  4. Inform the developer that he has to accept the invitations that was sent by github and npm via email.

Part 2 of the Assistant, transfer adapter:

  1. Github Login (done when logged in in developer portal)
  2. Enter adapter name (or chosse from list)
  3. Enter npm login credentials

Background tasks:

  • transfer ownership of Github repo to community
  • adjust paths
  • transfer npm packet to community
  • add team developers to packet
  • invite to telegram group
  • invite to discord
  • add user to contact list (private repo?), where only administrators has access to.
  • additional tasks?

Create new Release does not work

It all goes through and it also shows that it is successful, but no new tag is generated, the github action is not triggered.
I have tried twice, each time the same

CleanShot 06-06-2022 at 07 10 10
CleanShot 06-06-2022 at 07 12 05

Vorschläge zur Verbesserung

  • Klick auf Adapter Check macht nichts. Sollte bestenfalls zum Login führen wenn man noch nicht eingeloggt ist
  • Dokumentation finde ich wichtiger als Comminuty-Initiativen, das sollte bestenfalls ganz vorne stehen.

Version management for adapters

Idea: the developer can create new versions, and create PRs for ioBroker.repositories.

Creating a new version would only be possible if the release script is referenced in package.json.

The possible actions are:

  • create release (choose between major, minor, patch and edit Changelog)
  • add to latest (might contain the Adapter Check; only available if not yet in latest)
  • update (or add to) stable (might contain the Adapter Check; only available if in latest and not yet updated)

For both, we would need some additional scopes for the GitHub API.

Enhance Documentation card (or add more)

Maybe split up the documentation card to also link into the "developer best practices" in the repo github ... maybe also the review guidelined could be linked

If we need to addf more I would split "Documentation" (or "Resources?") with then 3 cards and next category is "Tools"

Add adapter versions to adapter details page

The following version information should be visible on the adapter cards:

  • version on GitHub
  • version on npm (=latest)
  • version in ioBroker stable repository

Perhaps a warning could be shown if there is a large gap between latest and stable (and perhaps between GitHub and latest).

Adapter Check does not work

Error message:

{"message":"Network Error","name":"Error","stack":"Error: Network Error\n at e.exports (https://www.iobroker.dev/static/js/2.95ff35b5.chunk.js:2:115579)\n at y.onerror (https://www.iobroker.dev/static/js/2.95ff35b5.chunk.js:2:114400)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"headers":{"Accept":"application/json, text/plain, */*"},"method":"get","url":"https://3jjxddo33l.execute-api.eu-west-1.amazonaws.com/default/checkAdapter?url=https%3A%2F%2Fgithub.com%2Fo0shojo0o%2FioBroker.adguard"},"status":null}

Screenshot:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.