LEPP

(Linux, NGINX, PostgreSQL, PHP)

Framework
LEPP
Category
Full Stack
Publisher
Jetify
{
  "packages": [
    "curl@latest",
    "postgresql@latest",
    "php@latest",
    "php83Extensions.pgsql@latest",
    "nginx@latest"
  ],
  "env": {
    "NGINX_WEB_PORT": "8089",
    "NGINX_WEB_ROOT": "../../../my_app",
    "PGPORT": "5433",
    "PGHOST": "/tmp/devbox/lepp"
  },
  "shell": {
    "scripts": {
      "create_db": [
        "dropdb --if-exists devbox_lepp",
        "createdb devbox_lepp",
        "psql devbox_lepp < setup_postgres_db.sql"
      ],
      "init_db": "initdb",
      "run_test": [
        "mkdir -p /tmp/devbox/lepp",
        "rm -rf .devbox/virtenv/postgresql/data",
        "initdb",
        "devbox services up -b",
        "echo 'sleep 2 second for the postgres server to initialize.' && sleep 2",
        "dropdb --if-exists devbox_lepp",
        "createdb devbox_lepp",
        "psql devbox_lepp < setup_postgres_db.sql",
        "curl localhost:$NGINX_WEB_PORT",
        "devbox services stop"
      ]
    }
  }
}

LEPP Stack

An example Devbox shell for NGINX, Postgres, and PHP. This example uses Devbox Plugins for all 3 packages to simplify configuration

Open In Devspace

How to Run

Initializing

In this directory, run: devbox run init_db to initialize a db.

To start the Servers + Postgres service, run: devbox services start

Creating the DB

You can run the creation script using devbox run create_db. This will create a Postgres DB based on setup_postgres_db.sql.

Testing the Example

You can query Nginx on port 80, which will route to the PHP example.

How to Recreate this Example

  1. Create a new project with:

    devbox create --template lapp-stack
    devbox install
  2. Update devbox.d/nginx/httpd.conf to point to the directory with your PHP files. You'll need to update the root directive to point to your project folder

  3. Follow the instructions above in the How to Run section to initialize your project.

Note that the .sock filepath can only be maximum 100 characters long. You can point to a different path by setting the PGHOST env variable in your devbox.json as follows:

"env": {
    "PGHOST": "/<some-shorter-path>"
}

Related Docs

README.md

Level up your dev environment

No need to switch your style. Devbox works with any coding language, so you can get results as you write.
PREPARE FOR LAUNCH

Plans for teams of any size

Jetify Cloud offers pricing plans for Solo Developers to Large Enterprises, and everything in between. All plans include free credits, and you are only billed for what you use. Need something custom? Contact our team and we can help.
YOUR INPUT COUNTS

Join the community

Discuss ideas, uses and builds with the Jetify team and others.