LAPP

(Linux, Apache, PostgreSQL, PHP)

Framework
LAPP
Category
Full Stack
Publisher
Jetify
{
  "packages": [
    "curl@latest",
    "php@latest",
    "php83Extensions.pgsql@latest",
    "apache@latest",
    "postgresql@latest"
  ],
  "env": {
    "PGHOST": "/tmp/devbox/lapp",
    "PGPORT": "5432"
  },
  "shell": {
    "scripts": {
      "create_db": [
        "dropdb --if-exists devbox_lapp",
        "createdb devbox_lapp",
        "psql devbox_lapp < setup_postgres_db.sql"
      ],
      "init_db": "initdb",
      "run_test": [
        "mkdir -p /tmp/devbox/lapp", 
        "initdb",
        "devbox services up -b",
        "echo 'sleep 5 second for the postgres server to initialize.' && sleep 5",
        "cat .devbox/compose.log",
        "dropdb --if-exists devbox_lapp",
        "createdb devbox_lapp",
        "psql devbox_lapp < setup_postgres_db.sql",
        "curl localhost:$HTTPD_PORT",
        "devbox services stop"
      ]
    }
  }
}

LAPP Stack

This example shows how to build a simple application using Apache, PHP, and PostgreSQL. It uses Devbox Plugins for all 3 packages to simplify configuration.

Open In Devspace

How to Run

The following steps may be done inside or outside a devbox shell.

  1. Initialize a database by running devbox run init_db.
  2. Create the database and load the test data by using devbox run create_db.
  3. Start Apache, PHP-FPM, and Postgres in the background by run devbox services start.
  4. You can now test the app using localhost:8080 to hit the Apache Server. If you want Apache to listen on a different port, you can change the HTTPD_PORT environment variable in the Devbox init_hook.

How to Recreate this Example

  1. Create a new project with:

    devbox create --template lapp-stack
    devbox install
  2. Update devbox.d/apache/httpd.conf to point to the directory with your PHP files. You'll need to update the DocumentRoot and Directory directives.

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

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.