Skip to content

SGTinkers/terawhere-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

833421e · May 31, 2017
May 31, 2017
May 1, 2017
May 29, 2017
May 28, 2017
May 6, 2017
May 3, 2017
May 27, 2017
May 6, 2017
May 15, 2017
May 28, 2017
May 1, 2017
May 21, 2017
May 18, 2017
May 17, 2017
May 24, 2017
May 1, 2017
May 1, 2017
May 29, 2017
May 18, 2017
May 17, 2017
May 29, 2017
May 29, 2017
May 1, 2017
May 29, 2017
May 29, 2017
May 14, 2017
May 14, 2017
May 3, 2017
May 1, 2017
May 1, 2017
May 1, 2017
May 26, 2017
May 18, 2017
May 1, 2017
May 3, 2017

Repository files navigation

Terawhere API Server

Documentation can be found here: https://sgtinkers.github.io/terawhere-laravel/#authenticate-user

  • Laravel 5.4
  • MySQL 5.6

Development Setup

Docker Compose Setup

  • Install Docker and Docker Compose on your local system
  • Install MySQL via Docker: docker run --name terawhere-mysql -e MYSQL_ROOT_PASSWORD=password -d -p 13306:3306 mysql:5.6
  • Create Database terawhere: docker run -it --link terawhere-mysql:mysql --rm mysql:5.6 sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" -e "create database terawhere"'
  • Copy .env.dev to .env
  • Configure .env accordingly to point to correct mysql
  • Run docker-compose run --rm -w /var/www phpfpm php docker/composer.phar install
  • Run docker-compose run --rm -w /var/www phpfpm php artisan migrate
  • Run docker-compose run --rm -w /var/www phpfpm php artisan key:generate
  • Run docker-compose run --rm -w /var/www node yarn install
  • Start the containers: docker-compose up
  • Edit your system host file (C:\Windows\System32\Drivers\etc\hosts or /etc/hosts) and add 127.0.0.1 terawhere.local (change 127.0.0.1 to reflect your Docker configuration if needed)

Development

Running artisan

  • docker-compose run --rm -w /var/www phpfpm php artisan
  • i.e. tinker: docker-compose run --rm -w /var/www phpfpm php artisan tinker

Running composer

  • docker-compose run --rm -w /var/www phpfpm php docker/composer.phar
  • i.e. require laravel/socialite: docker-compose run --rm -w /var/www phpfpm php docker/composer.phar require laravel/socialite

Running gulp

  • docker-compose run --rm -w /var/www gulp gulp

Running npm install

  • docker-compose run --rm -w /var/www gulp npm install

Running bower install

  • docker-compose run --rm -w /var/www gulp bower --allow-root install

Access Bash Shell inside container

  • docker exec -it terawherelaravel_phpfpm_1 bash
  • terawherelaravel_phpfpm_1 is the name of the container and might be different.

Committing

  • Run docker-compose run --rm -w /var/www phpfpm bash -c "chmod 777 tools/fmt && tools/fmt" script before committing to ensure consistency in code formatting

Generate Documentation

  • Run docker-compose run --rm -w /var/www phpfpm php artisan api:generate --routePrefix="api/*" --noResponseCalls --header "Authorization: JWTToken" --force --output docs

Running Tests

  • Run normal tests: docker-compose run --rm -w /var/www phpfpm bash -c "php tools/phpunit-6.1.phar"
  • Run test for facebook login: docker-compose run --rm -w /var/www phpfpm bash -c "FB_TOKEN='[PASTE_TOKEN_HERE]' php tools/phpunit-6.1.phar"

About

Laravel backend API for MSociety's Terawhere project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages