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
slate-cblrepository and any submodules:git clone --recursive git@github.com:SlateFoundation/scienceleadership-skeleton.git -
Change into cloned directory:
cd ./slate-cbl -
Launch studio:
Use the included scripts-to-rules-them-all workflow script to configure and launch a studio session:
script/studioReview 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-allto launch the http server (nginx), the application runtime (php-fpm), and a local mysql server:start-allAt this point, you should be able to open localhost:5520 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-siteAt this point, localhost:5520 should display the current build of the site
-
Load fixture data into site database (optional):
load-fixturesThe standard fixture data includes the following users:
Username Password AccountLevel About systemsystemDeveloperFull system access adminadminAdministratorManage site and staff teacherteacherStaffStaff access with teaching role in multiple courses sections teacher2teacher2StaffStaff access with teaching role in multiple course sections studentstudentUserStudent user with student role in multiple course sections student2student2UserStudent user with student role in multiple course sections student3student3UserStudent user with no roles in any course sections -
Make and apply changes:
After editing code in the working tree, you must rebuild and update the site:
update-siteA 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:
5526 - Username:
admin - Password:
admin