4.3.1. Developer environment setup

This is suitable for a local dev environment.

This docker will take care of all nxinx, php, composer, node, email, wiki and phpdoc in separate containers.

It assumes that you have already setup ApiOpenStudio and ApiOpenStudio Admin code-bases with the correct .env file settings.

4.3.1.1. Checkout the docker repo

git clone https://github.com/naala89/apiopenstudio_docker_dev

4.3.1.2. Configuration

cp example.env .env

Edit .env

  • Set API_CODEBASE to have the full path to your ApiOpenStudio code.
  • Set ADMIN_CODEBASE to have the full path to your ApiOpenStudio Admin code.

If you want to host the wiki and/or PHPDoc, uncomment:

WIKI_DOMAIN=wiki.apiopenstudio.local
PHPDOC_DOMAIN=phpdoc.apiopenstudio.local

It will work out of the box. However, if you change any settings in apiopenstudio or apiopenstudio_admin, such as the domains or SQL settings, you will need to edit these in the .env file too.

4.3.1.3. SSL certificates

4.3.1.3.1. Mac

brew install mkcert nss
mkcert -install
cd <apiopenstudio>/certs
mkcert -cert-file apiopenstudio.local.crt -key-file apiopenstudio.local.key "*.apiopenstudio.local"
cp "$(mkcert -CAROOT)/rootCA.pem" ca.crt

4.3.1.4. Wiki & PHPDoc (optional)

Edit docker-composer.yml

Uncomment the container blocks for:

  • bookdown
  • wiki
  • phpdocumentor
  • phpdoc

4.3.1.5. Hosts file

Update /etc/hosts to contain:

127.0.0.1      admin.apiopenstudio.local
127.0.0.1      api.apiopenstudio.local

Optionally add:

127.0.0.1      wiki.apiopenstudio.local
127.0.0.1      phpdoc.apiopenstudio.local

4.3.1.6. Spinning up docker

cd apiopenstudio_docker_dev
docker-compose up -d
docker exec -it apiopenstudio-php /bin/bash
cd api
./includes/scripts/install.php