ozgrozer / jaydon

Nginx control panel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jaydon

tag license Follow new releases

Nginx Control Panel

This is an experimental control panel written for a niche reason. Use at your own risk.

Quick Installation

Ubuntu v22

curl -L https://raw.githubusercontent.com/ozgrozer/jaydon/master/install22.sh | bash

Ubuntu v18

curl -L https://raw.githubusercontent.com/ozgrozer/jaydon/master/install18.sh | bash

Before Installation

Unlike other control panels with Jaydon you control the versions of your softwares such as Nginx, Node.js etc.

Before you install Jaydon you need:

Ubuntu v22

# Install MongoDB
wget -nc https://www.mongodb.org/static/pgp/server-6.0.asc
cat server-6.0.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/mongodb.gpg >/dev/null
sudo sh -c 'echo "deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/mongodb.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" >> /etc/apt/sources.list.d/mongo.list'
sudo apt update
sudo apt install mongodb-org -y
sudo service mongod start

# Install Certbot
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot -y
sudo ln -s /snap/bin/certbot /usr/bin/certbot

# Install Nginx
sudo apt install nginx -y

# Install Git
sudo apt install git -y

# Install Node.js
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install nodejs -y

# Install Yarn
sudo npm i -g yarn

# Install PM2
sudo npm i -g pm2

Ubuntu v18

# Install MongoDB
sudo apt install gnupg -y
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt update -y
sudo apt install mongodb-org -y
sudo service mongod start
systemctl enable mongod.service

# Install Certbot
sudo apt install software-properties-common -y
sudo add-apt-repository universe -y
sudo add-apt-repository ppa:certbot/certbot -y
sudo apt update -y
sudo apt install certbot python-certbot-nginx -y

# Install Nginx
sudo apt install nginx -y

# Install Git
sudo apt install git -y

# Install Node.js
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install nodejs -y

# Install Yarn
sudo npm i -g yarn

# Install PM2
sudo npm i -g pm2

Installation

If you have all the dependencies above now you can install Jaydon.

# Clone Git repository
git clone https://github.com/ozgrozer/jaydon.git && cd jaydon

# Install dependencies
yarn install

# Build React app
yarn build

# Create necessary database tables
yarn run firstRun

# Start server with PM2
pm2 start ./src/backend/server.js --name jaydon -i max
pm2 startup
pm2 save

# Open your browser and go to
http://your-ip:1148

Update

Make sure update.sh is executable.

chmod +x update.sh

And just run it.

./update.sh

API

Jaydon API built on REST. It accepts requests as JSON and returns responses as JSON too.

Base URL.

http://your-ip:1148/api/v1

Example POST request.

{
  "meta": {
    "apiKey": "YOUR_API_KEY",
    "category": "domain|cronJob",
    "event": "create|read|update|delete"
  },
  "data": {
  }
}

"data" object.

// create domain
"data": {
  "domain": "example.com",
  "gitSupport": true,
  "sslSupport": true,
  "nginxConf": "configuration"
}

// read a domain
"data": {
  "id": "domain id"
}
// read domains
"data": {
}

// update domain
"data": {
  "id": "domain id",
  "domain": "example.com",
  "gitSupport": false,
  "sslSupport": false,
  "nginxConf": "configuration"
}

// delete domain
"data": {
  "id": "domain id"
}

---

// create cron job
"data": {
  "command": "node script.js",
  "schedule": "* * * * *"
}

// read a cron job
"data": {
  "id": "cron job id"
}
// read cron jobs
"data": {
}

// update cron job
"data": {
  "id": "cron job id",
  "command": "node script.js",
  "schedule": "* * * * *"
}

// delete cron job
"data": {
  "id": "cron job id"
}

Example 1: Create a domain with cURL.

curl http://your-ip:1148/api/v1 \
-X POST \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
  "meta": { "apiKey": "YOUR_API_KEY", "category": "domain", "event": "create" },
  "data": { "domain": "test.com", "gitSupport": false }
}
EOF
# {"success":true}
# {"success":false,"error":"error"}

Example 2: Update a cron job with Axios.

const axios = require('axios')

const postUrl = 'http://your-ip:1148/api/v1'
const postData = {
  meta: { apiKey: 'YOUR_API_KEY', category: 'cronJob', event: 'update' },
  data: { id: 'CRON_JOB_ID', command: '/usr/bin/node ~/script.js', schedule: '0 * * * *' }
}
axios
  .post(postUrl, postData)
  .then(res => {
    console.log(res.data)
    // {"success":true}
    // {"success":false,"error":"error"}
  })
  .catch(err => {
    console.log(err)
  })

Preview

Todo

  • Domains
  • Git
  • SSL
  • Cron Jobs
  • DNS
  • Logs
  • Monitor
  • API

Contribution

Feel free to contribute. Open a new issue, or make a pull request.

License

MIT

About

Nginx control panel

License:MIT License


Languages

Language:JavaScript 89.3%Language:SCSS 5.0%Language:Shell 4.1%Language:CSS 1.0%Language:Pug 0.4%Language:Dockerfile 0.2%