Alexandre Danault

Alexandre Danault

Under review

Since there is a ton of options we can set for sites in Ploi, we end up in a situation where our infrastructure documentation is only in Ploi. Reproducing a site, or deployinh a new one ends up being complicated (many options to set) or risky (forgetting an option) and somewhat time-consuming.

Don't get me wrong, Ploi is AWESOME, I totally love it. What I'm looking for here is a way to move the Ploi configuiration INTO my code, with my project. That way, creating new project means Ploi would only have to ask for a repo/branch, and if my Ploi config is in there, start configuring everything for me.

My idea is a simple yaml file (or any other format) called "Ploifile.yaml" at the root of your repo, something like this:

server:
  name: do-tor1-example
  # If this server name doesn't exist, create it using the info below (if supplied)
  # otherwise stop if it doesn't exist
  provider: digitalocean
  credentials: DO Alex
  region: tor1
  size: s-1vcpu-1gb
  os: ubuntu-22-04
  type: web
  
domain: 
  root: example.com  
  aliases:
    - test.example.com
    - www.example.com
    - www.test.example.com

ssl:
  provider: letsencrypt
  use_dns: true
  force: true

project:
  name: Internal Tools # Ploi project will be created if it doesn't exist
  type: laravel
  project_directory: /
  web_directory: /public

php:
  version: 8.3

laravel:
  horizon:

  # if "octane" config it set, create/update a daemon for it
  octane:
    server: swoole
    port: 8000
    max_requests: 500
    workers: auto
    watch: false
  # octane: false # To remove the octane daemon 
  # if the "reverb" config is set, create/update a daemon for it
  reverb:    
    host: 127.0.0.1
    port: 8080
  reverbe: false # To remove the reverb daemon

cron:
  # Cron job will be created/updated
  - command: "php /path/to/artisan schedule:run"
    schedule: "* * * * *"
    user: ploi
  - ...

queue:
  php: 8.3
  connection: redis
  ...

notifications:
  deploy:
    type: slack
    channel: "#deploy"

redirects:
  # Redirects will be created/updated
  - from: /redir
    to: https://redir.example.com
  - ...

system_user: 
  # System user will be created/updated
  name: example  
  sudo: false

nginx_config:

http_basic_auth:
  # HTTP Basic Auth users/paths will be created/updated
  - path: /admin
    user: admin
    password: password
  - ...

backup:
  files:
    - ...

I'm wondering if you think this would be a cool feature to add to Ploi.

I could create it as a standalone CLI app that uses the Ploi API, but it'd be nice to have an official support instead, and there are some limitations that are hard to get around (like knowing when a server is done installing). Also, it'd be more efficient on Ploi resources to rung this directly inside Ploi and have access directly to the DB, instead of me doing 100s of API calls.

I'm puting this out here to get a vibe of what others think.

Stan

Stan

· · Edited
·

Regarding the docs of the API, there is a param called webhook_url, which is triggered when the server is done installing.

Anyhow, as far as I know, it's only possible to add a website on an already installed server. See here.

So I assume, a standalone CLI app is something to be considered?

I would love to brainstorm with you!

1 total vote
Alexandre Danault
Alexandre Danault

Alexandre Danault

Item author
·
·

I dismissed the webhook for now because we can't reliably open an http port from the CLI and hope the webhook from Ploi will be able to reach it (we'd have to get the user's public IP and hope they don't have a firewall) or we'd need an external service to receive the hook, which means money and doesn't make the tool 100% self-sufficient.

For the sites, if the server (specified in the yaml file) doesn't exist, the worker would create it and add the site to it.

A standalone CLI is definitely possible, but I'm going to keep this as a second solution. This would feel much better if integrated directly in Ploi, and also be lighter on Ploi's resources.

I'll be waiting for Dennis' input on this. If he doesn't have time to do it in Ploi (I'd totally understand) then a CLI will be the way.

no votes yet
Stan

Stan

·
·

I spoke with Dennis about this item. Unfortunately, there is currently no time to implement this within Ploi.io in the near future.

I suggested creating a CLI for now, which seems like the most practical option. Plus, having a CLI would be handy regardless. I'm currently waiting for approval. I keep you posted!

Feel free to reachout to me if you want to brainstorm :)

no votes yet
Alexandre Danault

Alexandre Danault

Item author
· · Edited
·

Hi Stan !

Thanks for reaching out to Dennis, I appreciate getting an official response, and I totally understand that time can be rare.

I have other projects for now but I'll look into it in the future. If you want to keep contact, ping me at adanault@alcyon.dev and I'll share my progress and questions/ideas with you, we could even collaborate.

Thanks !

1 total vote
Stan
Dennis

Dennis

·
·

We just forked the original CLI package from Felix here: https://github.com/ploi/ploi-cli

Stan is now also maintainer on that to work on it! 💙

no votes yet
Ermeen

Ermeen

· · Edited
·

This is a great idea. Render has a similar concept called Blueprint File.

It would be great at least to have a way to define deploy scripts and Node.js tab settings, as these are often tightly coupled within the git repository itself.

no votes yet
You may use @ to mention someone.

IDEA for better IaC / DevOps / GitOps: "Ploifile"

4 total votes
Ermeen Julius Kiekbusch Stan Alexandre Danault
  • Dennis moved item to board Under review

    6 months ago
  • Alexandre Danault moved item to project Server Level Requests

    6 months ago
  • Alexandre Danault created the item

    6 months ago