问题
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