Coder Social home page Coder Social logo

pratadaniel94 / compose-to-easypanel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ravenbroetzmann/compose-to-easypanel

0.0 0.0 0.0 238 KB

Generate a deployable Easypanel Schmea from your docker compose file

Home Page: https://compose-to-easypanel.netlify.app/

JavaScript 0.43% TypeScript 99.57%

compose-to-easypanel's Introduction

Docker Compose to Easypanel

Easypanel is a Beautiful, Easy to use Server Control Panel based on Docker easypanel.io.

with this little App you are able to create an Easypanel Schema based on your docker-compose file

Quickstart

Ui App

View on Netlify

goto compose-to-easypanel.netlify.app

Local

  1. Clone The Repo gh repo clone ravenbroetzmann/compose-to-easypanel
  2. cd compose-to-easypanel
  3. yarn install,
  4. yarn dev
  5. the app should now be available on localhost:3000

Example

Creating an Mysql application with Adminer as Dashboard

Write The Compose

./docker-compose.yml

version: "3"
services:
  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

  db:
    image: mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: examplePassword
      MYSQL_PASSWORD: examplePasswordNonRoot

Go to the UI

paste the file contents in the left hand side textarea on the website

Copy the Schema

after running this command you can view and edit the schema on the right hand side

Generated Schema:

{
  "services": [
    {
      "type": "app",
      "data": {
        "projectName": "test",
        "serviceName": "adminer",
        "source": { "type": "image", "image": "adminer" },
        "ports": [{ "published": 8080, "target": 8080 }]
      }
    },
    {
      "type": "mysql",
      "data": {
        "projectName": "test",
        "serviceName": "db",
        "rootPassword": "examplePassword",
        "password": "examplePasswordNonRoot"
      }
    }
  ]
}

Create The Services

after you copied the schema you can go to your easypanel Dashboard. Go to your-project, select templates and scroll all the way down to developer an then click Create from Schema

Please note: Domains and Proxys are currently not supported, you need to add these manually via the Easypanel dashboard

Supported Docker Compose Properties

  • image
  • container_name
  • ports
  • environment
  • volumes
  • command

Image

Docker Compose File

# ...
image: easypanel/easypanel

Generated Schema

{
  "source": {
    "type": "image",
    "image": "easypanel/easypanel"
  }
}

Container Name

The property container_name represents the serviceName, the default serviceName is the key of the service object in the docker-compose file

#...
service050:
  container_name: "my-super-container-name" # This is the serviceName
  image: easypanel/easypanel
  #...
#...
service050: # This is the serviceName
  image: easypanel/easypanel
  # ...

Ports

docker-compose file:

# ...
ports:
  # outside:inside
  - 3000:3000
  - 8000:5000

Generated Schema:

{
  "ports": [
    {
      "published": 3000,
      "target": 3000
    },
    {
      "published": 8000,
      "target": 5000
    }
  ]
}

Environment

docker-compose file:

# ...
environment:
  SECRET: my-super-secret
  ANOTHER_SECRET: ohooho-secret

Generated Schema:

{
  "env": "SECRET=my-super-secret\nANOTHER_SCRET=ohooho-secret"
}

Its currently not supported to load your env variables through an .env file

# ...
environment:
  SECRET: ${SECRET} # that won't work !

Volumes

docker-compose file:

# ...
volumes:
  # outside:inside
  - ./my/bind:/etc/my/bind
  - my-volume:/etc/my/volume

Generated Schema:

{
  "volumes": [
    {
      "type": "bind",
      "hostPath": "./my/bind",
      "mountPath": "/etc/my/bind"
    },
    {
      "type": "volume",
      "name": "my-volume",
      "mountPath": "/etc/my/volume"
    }
  ]
}

Command

docker-compose file:

# ...
command: yarn start
# or
command: ["yarn", "start"]

Generated Schema:

{
  "deploy": {
    "command": "yarn start"
  }
}

Database Services

Easypanel supports all popular databases out of the box:

  • postgres
  • mysql
  • mongo
  • redis

The Cli automatically creates an database service if the official image is used, however sometimes you need to provide an custom image, to do that you need to provide and env Variable in your docker-compose named EASYPANEL_DATABASE with the value of one database service (postgres, mysql, mongo,redis)

you also need to provide an Password env variable, otherwise a new one is created

  • Mongo: MONGO_INITDB_ROOT_PASSWORD: <password>
  • Postgres: POSTGRES_PASSWORD: <password>
  • Redis: REDIS_PASSWORD: <password>
  • MySql: MYSQL_ROOT_PASSWORD: <root-pw>; MYSQL_PASSWORD: <password>

docker-compose file

db:
  image: "postgres"
  environment:
    POSTGRES_PASSWORD: "super-password"

Generated Schema

{
  "type": "postgres",
  "data": {
    "password": "super-password"
  }
}

With custom image

db:
  image: "myuser/postgres"
  environment:
    EASYPANEL_DATABASE: postgres
    PASSWORD: "super-password"

Generated Schema

{
  "type": "postgres",
  "data": {
    "image": "myuser/postgres",
    "password": "super-password"
  }
}

Contribution

Contribution is always welcome :-)

  1. Fork the Repo
  2. Create a Branch from master
  3. Edit the Source Code
  4. Submit a PR

compose-to-easypanel's People

Contributors

ravenbroetzmann avatar

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.