Deploy my app on heroku

白昼怎懂夜的黑 提交于 2019-12-25 03:34:40

问题


I am learning how to deploy my app on Heroku and need some guidance.

Background:

My app currently runs locally, and accesses MySQL database on my machine to pull data for making phone calls to people via Twilio. The scripts in my app are in PHP. So I what I want to do is to push both the scripts and mysql database onto heroku's cloud and schedule a specific script to run.

I have tried reading tutorials online (the most helpful one has been this), but I am still unable to figure the following:

1) how to push my scripts to heroku using git?

2) how to migrate the mysql db from my local machine to heroku?

3) how to get my scripts connecting to the mysql db in the cloud?

4) how to set up a job to call a specific script in heroku?

Most importantly, I need to figure out steps 1 and 2. How can I push my PHP scripts onto heroku soonest?


回答1:


git init for initating the project to git environment. Now you can able to track or commit files. For pushing to heroku you need to confiqure git

git init

git add .

git commit -m "added commit"

heroku create 

The heroku create command will do two things in front, It will create the new application on heroku domain and add application remote in local,

you can check the heroku remote using git remote -v

Then

git push heroku master

finally heroku strongly recommend you to use postgres. For mysql you may need to take DUMP file.

mysql -u root -p <database name> > file.sql

and after push you can import dump file from heroku bash environment .



来源:https://stackoverflow.com/questions/25619794/deploy-my-app-on-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!