GithubHelp home page GithubHelp logo

r7wx / easy-gate Goto Github PK

View Code? Open in Web Editor NEW
314.0 5.0 18.0 1.66 MB

A gate to your self hosted infrastructure

License: MIT License

HTML 8.52% Dockerfile 1.09% Makefile 0.41% Go 81.40% CSS 8.59%
go self-hosted docker startpage dashboard

easy-gate's Introduction


easy-gate

Release CodeFactor

A gate to your self hosted infrastructure


Easy Gate is a simple web application designed to serve as the central hub for your self-hosted infrastructure. With real-time parsing of services and notes from a configuration file, Easy Gate ensures seamless updates without the need to restart the application. Moreover, it offers the flexibility to assign items to specific user groups, allowing tailored access based on their IP addresses.

Features

  • Real-time parsing of services and notes from a configuration file (JSON/YAML) without requiring application restarts.
  • Flexible assignment of services and notes to one or more user groups, ensuring items are displayed exclusively to specific users based on their IP addresses.
  • Organization of services into categories.
  • Customizable theme and icons.
  • Versatile deployment options with the choice to run Easy Gate as a standalone executable, free from external dependencies, or as a Docker container.

Deployment

Standalone Executable

In order to run Easy Gate as a standalone executable, you can build it from source code or download a pre-built binary from the latest release.

Build from source:

git clone https://github.com/r7wx/easy-gate.git
cd easy-gate
make

Run executable:

easy-gate <path-to-config-file>

Configuration file can be either a JSON or a YAML file.

Docker

You can deploy an instance of Easy Gate by using Docker:

docker run -d --name=easy-gate \
  -p 8080:8080 \
  -v /path/to/easy-gate.json:/etc/easy-gate/easy-gate.json \
  --restart unless-stopped \
  r7wx/easy-gate:latest

By default the Easy Gate image will look for a configuration file in /etc/easy-gate/easy-gate.json, but this value can be overridden by using the EASY_GATE_CONFIG_PATH environment variable:

docker run -d --name=easy-gate \
  -p 8080:8080 \
  -v /path/to/easy-gate.yml:/another/path/easy-gate.yml \
  --restart unless-stopped \
  -e EASY_GATE_CONFIG_PATH=/another/path/easy-gate.yml \
  r7wx/easy-gate:latest

Docker Compose

You can run Easy Gate by using the provided docker-compose file:

services:
  easy-gate:
    image: r7wx/easy-gate:latest
    build: .
    container_name: easy-gate
    restart: unless-stopped
    ports:
      - 8080:8080
    volumes:
      - ./easy-gate.json:/etc/easy-gate/easy-gate.json
docker-compose up

By default the Easy Gate image will look for a configuration file in /etc/easy-gate/easy-gate.json, but this value can be overridden by using the EASY_GATE_CONFIG_PATH environment variable:

services:
  easy-gate:
    image: r7wx/easy-gate:latest
    build: .
    container_name: easy-gate
    restart: unless-stopped
    environment:
      - EASY_GATE_CONFIG_PATH=/etc/easy-gate/easy-gate.yml
    ports:
      - 8080:8080
    volumes:
      - ./easy-gate.yml:/etc/easy-gate/easy-gate.yml

Docker Compose (behind proxy)

If you need to host Easy Gate behind an already running nginx instance (or other reverse proxies), you can use the docker-compose file in the examples directory:

services:
  easy-gate:
    image: r7wx/easy-gate:latest
    container_name: easy-gate
    expose:
      - 8080
    networks:
      - nginx-net
    volumes:
      - ../easy-gate.json:/etc/easy-gate/easy-gate.json

  nginx:
    image: nginx:latest
    container_name: nginx
    ports:
      - 80:80
    networks:
      - nginx-net
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf

networks:
  nginx-net:
    driver: bridge

In order to correctly use the groups feature, the nginx instance (or your other reverse proxy) must be configured to use the X-Forwarded-For header:

[...]
location / {
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://easy-gate:8080;
}
[...]

It is also mandatory to set "behind_proxy" to true in your easy-gate configuration file:

[...]
"behind_proxy": true,
[...]

You can find the complete docker-compose and nginx configuration files in the examples directory. The same logic applies to standalone and Docker deployments.

Configuration

Easy gate can be configured by a JSON or a YAML configuration file. An example configuration is provided in the root directory of this repository (easy-gate.json/easy-gate.yml).

Options

  • addr: IP address to listen on
  • use_tls: If true, the application will use TLS
  • cert_file: Path to the SSL certificate file (if TLS is enabled)
  • key_file: Path to the SSL key file (if TLS is enabled)
  • behind_proxy: If true, the application will use the X-Forwarded-For header to determine the IP address of the client
  • title: Title of the application

Theme

Easy Gate theme can be configured by providing colors for background and foreground. Theme changes will be applied immediately.

Example of a dark mode theme:

JSON

"theme": {
  "background": "#1d1d1d",
  "foreground": "#ffffff",
}

YAML

theme:
  background: "#FFFFFF"
  foreground: "#000000"

It is also possible to use a custom css file by providing the path to the file:

JSON

"theme": {
  "custom_css": "/path/to/custom.css"
}

YAML

theme:
  custom_css: "/path/to/custom.css"

Keep in mind, even if you provide a custom css file, the background and foreground colors will still be applied as long as you provide the correct templating keys in your custom css file like so:

body {
  background: {{.Background}};
  color: {{.Foreground}};
}

Groups

Group entries are used to define which users can see which items, by providing the user subnet. Group functionality is useful when dealing with both internal network and VPN users.

JSON

"groups": [
  {
    "name": "internal",
    "subnet": "192.168.1.1/24"
  },
  {
    "name": "vpn",
    "subnet": "10.8.1.1/24"
  }
]

YAML

groups:
  - name: internal
    subnet: 192.168.1.1/24
  - name: vpn
    subnet: 10.8.1.1/24

Services

A service entry is used to define a service that is available in the infrastructure. Each service has the following configurable parameters:

  • name: the name of the service (ex. Internal Git, Jenkins, ...)
  • url: the service url (must be a valid url starting with http(s)://)
  • category (optional): service category (each service will appear under its own category).
  • groups: list of groups associated to this service (defined in the groups section). If no group is provided the item can be seen by all users:
  • icon (optional): the icon parameter accepts image URLs or data URI. If the icon parameter is not provided or empty, Easy Gate will try to fetch the service favicon and display it or fallback to a default icon.

JSON

{
  "name": "Git",
  "url": "https://git.example.internal",
  "groups": [
      "vpn"
  ]
},
{
  "name": "Portainer",
  "url": "https://portainer.example.all",
  "category": "Test",
  "icon": "data:image/png;base64,[...]",
  "groups": []
}

YAML

- name: Git
  url: https://git.example.internal
  groups:
    - vpn
- name: Portainer
  url: https://portainer.example.all
  category: "Test"
  icon: data:image/png;base64,[...]
  groups: []

Notes

A note entry is used to define a simple text note which has a title and a content. Each note has a name, the note content (text) and the groups that can see it (defined in the groups section). If no group is provided the item can be seen by all users:

JSON

{
  "name": "Simple note",
  "text": "This is a simple note for vpn users",
  "groups": [
    "vpn"
  ]
},
{
  "name": "Global note",
  "text": "This note will be visible to everyone",
  "groups": []
}

YAML

- name: Simple note
  text: This is a simple note for vpn users
  groups:
    - vpn
- name: Global note
  text: This note will be visible to everyone
  groups: []

Environment Variables

  • EASY_GATE_CONFIG_PATH: Easy Gate configuration file path can be provided by this environment variable. The value will have precedence over the configuration file path provided in the command line.
  • EASY_GATE_CONFIG: Insted of providing a configuration file, it is possible to provide the entire configuration as a JSON or YAML string in this environment variable. The content of this variable will have precedence over the configuration file.

easy-gate's People

Contributors

5amu avatar dzonerzy avatar r7wx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

easy-gate's Issues

Need help running behind reverse proxy (traefik)

Hi there,

I run plenty of little apps behind a reverse proxy but I can't get this one working. I might be too dumb to follow your instructions to run easy-gate behind a configured nginx which I assume applies to running it behind a configured traefik too?

Here is where I'm stuck:

accessing easy-gate directly works fine: http://10.10.10.10:8080/ but as soon as I access it via my reverse proxy: https://my.domain.tld I get this error:

{
	"Message": "no app for hostname",
	"Host": "my.domain.tld",
	"Detail": "Check the outpost settings and make sure 'my.domain.tld' is included."
}

I searched the code on this site for the word outpost and later for the word hostname without any hits so I am at a loss as to where and how exactly to tell easy-gate that it may respond to my.domain.tld :-/

Any help is much appreaciated.

Is there a way to embed html in a note?

The title pretty much says it all, is there a way to embed an iframe into a note, or replace a note with such a thing? If not, that might be a cool feature to add if it is not too complex or would bloat the code.

Love the project and the style btw!

Failure to Launch

Hello! I think I'm overlooking something basic. I use the following docker run command to launch Easy Gate and the following JSON file but no matter what, Easy Gate just shows a loading icon. I tried starting Easy Gate without mounting a config file and it starts but then I can't figure out how to view files in the container (bash, ash, sh, and cat all fail). I also tried varying levels in the JSON file. below is the most basic. I also tried with groups and services stanzas.

docker run -d \
	--restart always \
	--network better_bridge \
	--name=EasyGate \
	-v /mnt/Docker/EasyGate/easy-gate.json:/etc/easy-gate/easy-gate.json \
	r7wx/easy-gate
{
  "addr": "0.0.0.0:8080",
  "behind_proxy": true,
  "title": "Easy Gate",
  "icon": "fa-solid fa-cubes",
  "motd": "Welcome to Easy Gate",
  "theme": {
    "background": "#FFFFFF",
    "foreground": "#000000"
  }
}

Group Links

Is there a way to divide the links into subgroups or to change the layout?
Many Thanks

[Feature Request] Options / Settings

Hey. I just started using Easy Gate and i'm really missing settings page where i could configure everything just by Web UI (no manual writting to json file).

Is this on roadmap?

Improve logging

Improve logging, especially on errors on misconfigured X-Forwarded-For header.
Also, implements the ability to save logs to file (must be optional).

Custom CSS

Are there any plans for a custom CSS system? (loading external stylesheet for overrides, etc...)

This would allow more advanced customization of elements (note colors, service colors, etc.)

image

Thanks !

Question about the "group" function

looking at the sample files, it looks like depending on how you call easy-gate you get to see different things, right?

Seems great at a first glance but looking close I figured out that I have to access easy-gate via fqdn if outside the house, use 10.10.10.x if coming through VPN and 192.168.x.y if from within my local LAN.

Would it not be better or even possible to not decide upon the method of access but upon the client IP?
This way I imagine I could always access easy-gate via fqdn and a revere proxy and depending on my client IP I would see different services?
At a first glance this seems more logical, I would only have to remember 1 address where easy-gate is running and it would automatically present me the right resources depending on my IP so if it sees my IP is a public one it'd know I'm somewhere else, seeing a 10.x range it would know I'm on the VPN and seeing 192.168.x it would know I'm on my local lan.

Is this even possible?

[Feature Request] IP Adress related redirecting

Hey. I'm pretty sure this has to be edge case that wouldn't use many users but i have ZeroTier set up for accessing my services from outside of local network. I'm really annoyed when i need to manually rewrite IP and port of the service because i'm not on the local network.

Example:
My zerotier ip: 192.168.192.10
My server's zerotier ip: 192.168.192.15 (and in local network it is 192.168.1.15)

I have configured inside Easy Gate local IP of that service (192.168.1.15:9000). But i'm accessing it from outside the network via zerotier so when i click the button, it want to load the 192.168.1.15:9000 instead of 192.168.192:9000.

Solution

Add option to make redirection based on IP that is connected to Easy Gate.

[Portainer][Error Code 400] Unable to deploy with Portainer

Hello. I'm pretty sure the fault is on my side somewhere but i'm unable to deploy Easy Gate via Portainer. Don't get me wrong, i already spun up more than 20 containers but i tried to deploy this one for 3 times now and got error with code 400 after each try.

Any clues?

Dark Mode

Found you! :)

Any plans for a dark mode? Also what other feature are planned?

Custom Icons

Love the simplicity of this!

At risk of asking for more complexity and breaking a core principle of this project, would you consider adding the ability to use arbitrary images as icons? Either by URL or loaded from a local assets folder. Font Awesome is great but I've quickly found myself wanting to embed custom icons (like TP Link's icon for network portals, Traefik's icon for that dashboard, etc., etc.)

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.