在heroku上部署我的应用程序 [英] Deploy my app on heroku
问题描述
背景:
我的应用程序当前在本地运行,并访问我的计算机上的MySQL数据库,以便通过Twilio将数据用于拨打电话给人们。我的应用程序中的脚本使用PHP。所以我想要做的就是将脚本和mysql数据库都推送到heroku的云上,并安排一个特定的脚本来运行。
我曾尝试在线阅读教程(最有帮助的一个这个),但我仍然无法计算出以下内容:
1) 2)如何将mysql数据库从本地机器迁移到heroku?如何使用git将我的脚本推送到heroku? 3)如何让我的脚本连接到云中的mysql数据库?
4)如何让我的脚本连接到云中的mysql db?设置一个工作来调用heroku中的特定脚本?
最重要的是,我需要找出第1步和第2步。我怎样才能将我的PHP脚本最快推送到heroku上?
git init
用于启动项目到git环境。现在您可以跟踪
或提交文件。要推送到heroku,你需要配置git
git init
git add。
git commit -m添加提交
heroku创建
heroku create
命令将在前面做两件事,它将在heroku域上创建新的应用程序,并在本地添加应用程序远程,
您可以使用 git remote -v
检查heroku远程
git push heroku master
heroku强烈建议您使用 postgres
。对于 mysql
,您可能需要将 DUMP
文件。
mysql -u root -p<数据库名称> > file.sql
在推送后,您可以从heroku bash
环境。
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?
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 .
这篇关于在heroku上部署我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!