Local Studio Container ¶
This guide will walk you through launching a Docker-container local development studio and using it to test changes made within a local Git repository.
Launch studio container ¶
-
Install Chef Habitat:
curl -s https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | sudo bash
-
Set up Chef Habitat, accepting defaults for all prompts:
hab setup
-
Clone
laddr
repository and any submodules:git clone --recursive git@github.com:CodeForPhilly/laddr.git
-
Change into cloned directory:
cd ./laddr
-
Launch studio:
Use the included scripts-to-rules-them-all workflow script to configure and launch a studio session:
script/studio
Review the notes printed to your terminal at the end of the studio startup process for a list of all available studio commands.
Bootstrap and develop backend ¶
-
Start services:
Use the studio command
start-all
to launch the http server (nginx), the application runtime (php-fpm), and a local mysql server:start-all
At this point, you should be able to open localhost:9070 and see the error message
Page not found
. -
Build site:
To build the entire site and load it, use the studio command
update-site
:update-site
At this point, localhost:9070 should display the current build of the site
-
Load fixture data into site database (optional):
load-fixtures
The standard fixture data includes the following users:
Username Password AccountLevel About system
system
Developer
Full system access admin
admin
Administrator
Manage site and staff staff
staff
Staff
Staff access user
user
User
Regular user -
Make and apply changes:
After editing code in the working tree, you must rebuild and update the site:
update-site
A command to automatically rebuild and update the site as changes are made to the working tree is also available, but currently not that efficient or reliable:
watch-site
Enable user registration ¶
To enable user registration on a site that comes with it disabled:
# write class configuring enabling registration
mkdir -p php-config/Emergence/People
echo '<?php Emergence\People\RegistrationRequestHandler::$enableRegistration = true;' > php-config/Emergence/People/RegistrationRequestHandler.config.php
# rebuild environment
update-site
After visiting /register
and creating a new user account, you can use the studio command promote-user
to upgrade the user account you just registered to the highest access level:
promote-user <myuser>
Connect to local database ¶
The studio container hosts a local MySQL instance that can be connected to at:
- Host:
localhost
(or LAN/WAN IP of machine hosting Docker engine) - Port:
9076
- Username:
admin
- Password:
admin