Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Example StackHead configuration for a PHP application

Notifications You must be signed in to change notification settings

getstackhead/sample-project-php

Repository files navigation

PHP sample project

This is a sample repository for deploying a PHP application and serving it on a domain using StackHead, the Open-Source Web Server management.

It provides examples for deploying a single and multi container applications.

Requirements

In order to try out this sample project, you'll need the following:

Initialize StackHead by running the command below. This will install all dependencies required.

stackhead-cli init

How to use

Server provisioning

stackhead-cli setup 159.69.20.148

After provisioning completed, you should see the Nginx default page when opening your domain in your browser.

Application deployment

The following sections describe how to configure the samples for your server and domain. There are two differently sized projects, consisting of one single container and multiple containers.

Single container application

  1. Adjust the project settings in .stackhead/project/single-container.stackhead.yml

    1. Set your own domain in domain
  2. Validate your project file using the validate command:

    stackhead-cli project validate ./.stackhead/project/single-container.stackhead.yml
  3. Deploy the application. Make sure to replace 159.69.20.148 with your servers IP address.

    stackhead-cli project deploy ./.stackhead/project/single-container.stackhead.yml 159.69.20.148
  4. After deployment, open the domain in your web browser. You should see a page that prints "Hello world!" alongside the PHP version and successful database connection.

  5. Remove the application:

stackhead-cli project destroy ./.stackhead/project/single-container.stackhead.yml

Multi container application

  1. Adjust the project settings in .stackhead/project/multi-container.stackhead.yml

    1. Set your own domain in domain
  2. Validate your project file using the validate command:

    stackhead-cli project validate ./.stackhead/project/multi-container.stackhead.yml
  3. Deploy the application. Make sure to replace 159.69.20.148 with your servers IP address.

    stackhead-cli project deploy ./.stackhead/project/multi-container.stackhead.yml 159.69.20.148
  4. After deployment, open the domain in your web browser. You should see a page that prints "Hello world!" alongside the PHP version and successful database connection.

    You can access PhpMyAdmin on port 81 (no HTTPS).

  5. Remove the application:

stackhead-cli project destroy ./.stackhead/project/multi-container.stackhead.yml