| Version | Date | Notes | By |
|---|---|---|---|
| 0.5 | 2018-01-02 | Changed to git repositories | JFM |
| 0.4 | 2017-12-05 | Updated backend .env with new environment variables | FPA |
| 0.3 | 2017-12-05 | Updated Homestead.yaml sites | FPA |
| 0.2 | 2017-04-05 | Homestead fix | ACL |
| 0.1 | 2016-10-22 | Initial release | JFM |
TODO: improve the various software installations (Vagrant, Git, etc..)
Some configurations are temporary and will changed in the future
This will guide you through the instalation of tha backend and frontend of the SGIV10 framework
Go to virtualbox website (https://www.virtualbox.org/), download the version download the version for your operating system and (if needed) follow the instructions here: https://www.virtualbox.org/manual/ch02.html
Go to vagrant website (https://www.vagrantup.com/) download the version for your operating system and (if needed) follow the instructions here: https://www.vagrantup.com/docs/installation/
Go to git website (https://git-scm.com/) download the version for your operating system and install it
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.
This way, the development team can have all the same environment without the need to worry what versions of PHP, MariaBD, etc.. to install
Open the command line (use git) and run: vagrant box add laravel/homestead
This will add the homestead box to you vagrant instalation
Create a folder named vagrant somewhere on your drive
In the vagrant folder run the command: git clone https://github.com/laravel/homestead.git Homestead
Go to the Homestead folder and run bash init.sh for linux/mac or init.bat for windows
This will create the Homestead.yaml file in .\vagrant\Homestead\resources.
Generate an ssh key pair with the following command on Git: ssh-keygen -t rsa
This will generate a .ssh folder on your home directory ( C:\Users\User\.ssh\ ) with the ssh key pair
Open the Homestead.yaml file and use the following configuration:
ip: "192.168.10.10"
memory: 4096
cpus: 1
provider: virtualbox
mariadb: true
#use just one option
authorize: ~/.ssh/id_rsa.pub #for linux
authorize: C:\Users\user\.ssh\id_rsa.pub #for windows
#use just one option
keys:
- C:\Users\user\.ssh\id_rsa #for windows
- ~/.ssh/id_rsa #for linux
folders:
- map: E:\Devel\vagrant\shared
to: /home/vagrant/shared
sites:
- map: wemake-sgi-backend.devel
to: /home/vagrant/shared/projects/wemake/sgi/wemake-sgi-backend/public
- map: wemake-sgi-frontend.devel
to: /home/vagrant/shared/projects/wemake/sgi/wemake-sgi-frontend/export
databases:
- sgiv10_wemake
variables:
- key: APP_ENV
value: development
Add the sgiv10-backend.devel and sgiv10-frontend.devel to your host files ( located in C:\Windows\System32\drivers\etc\ ). For instance, 192.168.10.10 sgiv10-backend.devel
Create the needed folders inside the vagrant folder (Ex: vagrant/shared/projects/sgiv10/frontend)
Go to the Homestead folder and run: vagrant up --provision if this is the first time doing vagrant up, or if you change the configuration. Otherwise use only vagrant up
This will launch the vagrant box
If you get a "The requested address is not valid in its context" error just add host_ip: "127.0.0.1" to the homestead.rb file in line 90
When the box finishes launching you should be able to access it by SSH using the command vagrant ssh
After accessing via SSH update the machine and install the necessary php extensions:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install php-ldap
If needed you can check the laravel instrutions here https://laravel.com/docs/5.3/homestead
Node.js already comes installed on Homestead, but you might want to install it also on your local machine. Go to Node.js website (https://nodejs.org/en/) download the version download the version for your operating system and install it
npm package is installed with Node.js so it should be already installed.
Check by running: npm --version
jspm needs npm so be sure that you got that installed.
To instal just run the command: npm install jspm -g
Ok, first lets checkout the backend. Go to the folder you have configured on the Homestead.yaml file, in our case /home/vagrant/shared/projects/sgiv10/ and checkout the project:
```
git clone https://gitlab.wemake.pt/wemake/sgi/backend/core.git backend
cd backend
git checkout develop
```
Next, on the backend folder, copy the .env.example file to .env, edit it and change the configurations accordingly.
Check the .env file documentation
.env Example
APP_ENV=local
APP_SYSTEM=linux
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_KEY=SomeRandomString
APP_NAME=sgiv10
APP_BACKEND_URL=http://localhost
APP_FRONTEND_URL=http://localhost:9000
APP_TIMEZONE=Europe/Lisbon
APP_LOCALE=pt
APP_FALLBACK_LOCALE=en
APP_BACKEND_LOCALE=en
APP_AUTH_PROVIDER=eloquent
APP_NOTIFY_INTERNAL_COMMUNICATIONS_BY_MAIL=false
APP_INSTALLED_MODULES=null
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=sgiv10_wemake
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
QUEUE_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
REDIS_DB_NUM=0
MAIL_DRIVER=sparkpost
MAIL_HOST=smtp.sparkpostmail.com
MAIL_PORT=587
MAIL_FROM_ADDRESS=notifications@wemake.pt
MAIL_FROM_NAME="WeMake"
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
SPARKPOST_SECRET=f5dae2ea0a78d05af4452b0e219dfb000c5275f5
SENTRY_PRIVATE_DSN=https://201633a77e45489895c44a0676d6616c:505e9ad109ad440f978e873b2638faed@sentry.io/109421
SENTRY_PUBLIC_DSN=https://201633a77e45489895c44a0676d6616c@sentry.io/109421
ADLDAP_ACCOUNT_SUFFIX=@panda.wemake.pt
ADLDAP_CONTROLLERS=192.168.0.20
ADLDAP_BASEDN=dc=panda,dc=wemake,dc=pt
ADLDAP_ADMIN_ACCOUNT_SUFFIX=@panda.wemake.pt
ADLDAP_ADMIN_USERNAME=username
ADLDAP_ADMIN_PASSWORD=password
ADLDAP_LOGIN_FALLBACK=true
ADLDAP_PASSWORD_SYNC=true
GARDENER_DIRECTORY=seeds
LICENSES_NUMBER=999
JWT_TTL=720
Do NOT forget to enable the php_ldap php extension
Install all dependencies our software needs by running: composer install
If needed you should change the APP_KEY directive. Go to the backend folder and run the command php artisan key:generate
Run the migrations and seed the database: php artisan migrate --seed
Install the Laravel Echo Server: sudo npm install -g laravel-echo-server copy the laravel-echo-server.example.json file to laravel-echo-server.json and change the authHost and the host to the backend host
Example:
"authHost": "http://sgiv10-backend.devel",
...
"host": "sgiv10-backend.devel",
php artisan queue:work &
nohup laravel-echo-server start &You can install/configure the frontend on the Homestead machine, but we recommend using you local machine to speed things up.
Go to the folder you have configured on the Homestead.yaml file, in our case (/home/vagrant/shared/projects/sgiv10/) and checkout the project:
git clone https://gitlab.wemake.pt/wemake/sgi/frontend/frontend.git frontend
cd frontend
git checkout develop
Next install all node.js/system.js dependencies our software needs. Go drink a because this may take some time:
npm install - If the host machine is windows run this instead: npm install --no-bin-links
jspm install
sudo npm install -g gulp
Open the file src/commom/services/laravel-echo-service.js and change the host property
Create a env.js file from the env.example.js template and set the backendBaseUrl to the backend URL ( which should be 'http://sgiv10-backend.devel' )
Copy the file build/watches.example.js to build/watches.js and configure the modules you need gulp to watch
After this, check in folder temp-fixes if there's something you need to do before running the server. Then just run:
gulp watch
This command starts a server and watches for changes on file in the folders define on the build/watches.js file