Deploy

Once we have our application static files and our index.php entry point file, let's create a new Heroku application. Navigate to the dist folder and init a new Git repository running the following commands:

$ cd dist
$ git init
$ git add .
$ git commit -m "My Application commit"
We use git add following by a period (.) to add all the files to the staging area. It means all the changes will be candidates to commit.

Once we have our local git repository, let's create a new Heroku application named mydeploymeapp. Execute the following command:

$ heroku apps:create deploymeapp

Creating deploymeapp... done
https://deploymeapp.herokuapp.com/ | https://git.heroku.com/deploymeapp.git

We use the Heroku CLI tool and call the apps:create option to create a new application. You have to change the application's name, because they should be globally different from other app's names. Once created, Heroku will respond with the application's URL.

Now that we have our application created, let's push the code to the Git repository created by Heroku to host our application's code and see the results. Execute the following command:

$ git push heroku master

Counting objects: 3, done.
...
remote:
remote: -----> PHP app detected
remote:
...
done.
To https://git.heroku.com/mydeploymeapp.git
15cb66e..72d4d2a master -> master

As you can see, Heroku will recognize automatically that we are deploying a PHP application, and it will deploy our application. Let's go ahead and navigate to your application's URL; mine is https://mydeploymeapp.herokuapp.com:

Awesome! Now that we know how to deploy our application on the cloud using Heroku, let's explore how can we do this with another very popular cloud provider. We will learn how to deploy our website using Amazon Simple Storage Service (Amazon S3). Keep reading!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset