PHP versions on macosx

CLI

Install

Get the version you want from here https://php-osx.liip.ch.

Add the new php binary to the end of your path https://php-osx.liip.ch/#faq.

export PATH=/usr/local/php5/bin:$PATH

Reload your .bash_profile

Check the PHP version

php -v

Revert

Remove the PHP binary you added in your .bash_profile

 

Advertisements

Elastic beanstalk Laravel

I tried this setup and it works well.

I have been encountering an issue where my RDS cannot connect to new instances EB load balancer spins up. I assume I have not configured EB properly. Take a look at this guide instead.

Amazon account

Create a new IAM user access_id and secret_key.

Elastic beanstalk CLI

Please install:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html?icmpid=docs_elasticbeanstalk_console

App repo

Clone your repo into a new directory and go to it.

Fire up a new EB instance

$ eb init
If you have multiple profiles in your ~/.aws/config
$ eb init --profile name

Deploy app

For the initial deployment.
This is going to fail because we haven’t uploaded our configs.
We want classic deployment.
$ eb create environment_name

Deploy database

Do not create a DB with EB.
Create a separate RDS instance in your management console.
Add it to your App’s security group.

Run on deployment

Add these files to your project before you deploy:
https://github.com/jianliyow/elasticbeanstalk-laravelconfigs

$ eb deploy

App config

Set the APP_URL in configuration > software configuration.
e.g. http://localhost or https://staging.example.com

Database config

Go to EB > configuration > software and add your config.
It must reflect database.pro

S3 bucket config

https://jianliyow.wordpress.com/2017/08/23/aws-s3-bucket-policy-and-iam-policy/

Production environment

Clone the staging environment in AWS console. Initially it will fail.

Database config

  • Allow office IP
  • Copy the data over to the new DB

Route 53

Route 53 > Hosted Zone > Create a hosted zone.
Point domain name to AWS name servers.
Create aliases.

Create SSL cert

Certificate manager > request a cert

Redirect to https

Configuration > Load balancing > Protocol & SSL Certificate ID

Uncomment https redirect in .ebextensions/01setup.config

Install https-enforcement:

composer require owenmelbz/https-enforcement

* 3- Apparently you don’t need to include this in your .env

Add this condition to your AppServiceProvider boot method.