Generic LAMP
A Generic LAMP stack should work with most PHP/MySQL web applications. You may need to do some customizing, but this should get you started.
Configure Tugboat
The Tugboat configuration is managed by a YAML file at
.tugboat/config.yml in the git repository. Here’s a basic LAMP configuration you can use as a starting point, with
comments to explain what’s going on:
1services:
2 # What to call the service hosting the site.
3 php:
4 # Use PHP 7.1 with Apache
5 image: tugboatqa/php:apache
6
7 # Set this as the default service. This does a few things
8 # 1. Clones the git repository into the service container
9 # 2. Exposes port 80 to the Tugboat HTTP proxy
10 # 3. Routes requests to the preview URL to this service
11 default: true
12
13 # A set of commands to run while building this service
14 commands:
15 # Commands that set up the basic preview infrastructure
16 init:
17 # Link the document root to the expected path. This example links
18 # /htdocs to the docroot
19 - ln -snf "${TUGBOAT_ROOT}/htdocs" "${DOCROOT}"
20
21 # What to call the service hosting MySQL. This name also acts as the
22 # hostname to access the service by from the php service.
23 mysql:
24 # Use the latest available version of MySQL by not specifying a
25 # version
26 image: tugboatqa/mysql:5-debian
27
28 # A set of commands to run while building this service
29 commands:
30 # Commands that import files, databases, or other assets. When an
31 # existing preview is refreshed, the build workflow starts here,
32 # skipping the init step, because the results of that step will
33 # already be present.
34 update:
35 # Copy a database dump from an external server. The public
36 # SSH key found in the Tugboat Repository configuration must be
37 # copied to the external server in order to use scp.
38 - scp user@example.com:database.sql.gz /tmp/database.sql.gz
39 - zcat /tmp/database.sql.gz | mysql tugboat
40 - rm /tmp/database.sql.gzWant to know more about something mentioned in the comments of this config file? Check out these topics:
- Name your Service
- Specify a Service image
- Leverage Service commands
- Define a default Service
- Set the document root path
- Set up remote SSH access
- Preview build process phases (
init,update,build) - How Base Previews work
Start Building Previews!
Once this Tugboat configuration file is committed to your git repository, you can start building previews!