CoreyMSchafer / code_snippets

MIT License
10.26k stars 17.65k forks source link

Deployment on Heroku #91

Open JayantS08 opened 4 years ago

JayantS08 commented 4 years ago

Sir , Whenever I deploy my website on heroku . The one u taught in flask tutorial on YouTube . It gets deployed without an error but on the link it always shows error. Can you plzz help me out. May be you can guess where I may be committing a mistake.

JayantS08 commented 4 years ago

Can issue be because of saving secret keys in environment variables then plss demonstrate to how to deploy it on heroku

41alderson commented 4 years ago

Can You be more specific about your problem? or just execute heroku logs --tail and comment the logs here.

41alderson commented 4 years ago

desc="No web processes running

You are getting this error of the reasons below, Error in Procfile or You haven't scaled up your heroku dynos.

Running this command should scale up your dynos and fix the above error.

heroku ps:scale web=1 or no of dynos u want to scale on your web app

JayantS08 commented 4 years ago

Thanx but i got that error so i deleted my comment and changed the procfile could you now help me with these Logs :

2020-02-16T11:17:49.946962+00:00 app[api]: Release v1 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:49.946962+00:00 app[api]: Initial release by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Release v2 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Enable Logplex by user jayant.singh0801@gmail.com 2020-02-16T11:20:58.000000+00:00 app[api]: Build started by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Release v3 created by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Deploy 2be0be17 by user jayant.singh0801@gmail.com 2020-02-16T11:21:47.000000+00:00 app[api]: Build succeeded 2020-02-16T11:21:49.442656+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=prime-blog1.herokuapp.com request_id=0b8d5dc0-9fce-403e-b56f-ec5ab860d042 fwd="106.215.149.44" dyno= connect= service= status=503 bytes= protocol=https 2020-02-16T11:21:50.056406+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=prime-blog1.herokuapp.com request_id=73be35df-b562-4721-963b-78d5dda5ecf8 fwd="106.215.214.236" dyno= connect= service= status=503 bytes= protocol=https

41alderson commented 4 years ago

Can u please send the Procfile you are using.

Cause the error you are getting is same.

ImOmkar commented 4 years ago

Check your Procfile's extension.

On Sun, Feb 16, 2020, 4:54 PM Jayant Singh notifications@github.com wrote:

Thanx but i got that error so i deleted my comment and changed the procfile could you now help me with these Logs :

2020-02-16T11:17:49.946962+00:00 app[api]: Release v1 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:49.946962+00:00 app[api]: Initial release by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Release v2 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Enable Logplex by user jayant.singh0801@gmail.com 2020-02-16T11:20:58.000000+00:00 app[api]: Build started by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Release v3 created by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Deploy 2be0be17 by user jayant.singh0801@gmail.com 2020-02-16T11:21:47.000000+00:00 app[api]: Build succeeded 2020-02-16T11:21:49.442656+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host= prime-blog1.herokuapp.com request_id=0b8d5dc0-9fce-403e-b56f-ec5ab860d042 fwd="106.215.149.44" dyno= connect= service= status=503 bytes= protocol=https 2020-02-16T11:21:50.056406+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host= prime-blog1.herokuapp.com request_id=73be35df-b562-4721-963b-78d5dda5ecf8 fwd="106.215.214.236" dyno= connect= service= status=503 bytes= protocol=https

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CoreyMSchafer/code_snippets/issues/91?email_source=notifications&email_token=AKBSIYUPWJPOXVECWUIC73TRDEO53A5CNFSM4KPRJKFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL4ECSQ#issuecomment-586694986, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKBSIYRXX63HR26EOUNDSKDRDEO53ANCNFSM4KPRJKFA .

41alderson commented 4 years ago

Thanx but i got that error so i deleted my comment and changed the procfile could you now help me with these Logs :

2020-02-16T11:17:49.946962+00:00 app[api]: Release v1 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:49.946962+00:00 app[api]: Initial release by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Release v2 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Enable Logplex by user jayant.singh0801@gmail.com 2020-02-16T11:20:58.000000+00:00 app[api]: Build started by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Release v3 created by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Deploy 2be0be17 by user jayant.singh0801@gmail.com 2020-02-16T11:21:47.000000+00:00 app[api]: Build succeeded 2020-02-16T11:21:49.442656+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=prime-blog1.herokuapp.com request_id=0b8d5dc0-9fce-403e-b56f-ec5ab860d042 fwd="106.215.149.44" dyno= connect= service= status=503 bytes= protocol=https 2020-02-16T11:21:50.056406+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=prime-blog1.herokuapp.com request_id=73be35df-b562-4721-963b-78d5dda5ecf8 fwd="106.215.214.236" dyno= connect= service= status=503 bytes= protocol=https

Enter "heroku ps" (without quotes) and send the output.

As per heroku h14 error code is raised when no web dynos is running.

JayantS08 commented 4 years ago

Check your Procfile's extension. On Sun, Feb 16, 2020, 4:54 PM Jayant Singh @.> wrote: Thanx but i got that error so i deleted my comment and changed the procfile could you now help me with these Logs : 2020-02-16T11:17:49.946962+00:00 app[api]: Release v1 created by user @. 2020-02-16T11:17:49.946962+00:00 app[api]: Initial release by user @. 2020-02-16T11:17:50.066725+00:00 app[api]: Release v2 created by user @. 2020-02-16T11:17:50.066725+00:00 app[api]: Enable Logplex by user @. 2020-02-16T11:20:58.000000+00:00 app[api]: Build started by user @. 2020-02-16T11:21:37.887085+00:00 app[api]: Release v3 created by user @. 2020-02-16T11:21:37.887085+00:00 app[api]: Deploy 2be0be17 by user @. 2020-02-16T11:21:47.000000+00:00 app[api]: Build succeeded 2020-02-16T11:21:49.442656+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host= prime-blog1.herokuapp.com request_id=0b8d5dc0-9fce-403e-b56f-ec5ab860d042 fwd="106.215.149.44" dyno= connect= service= status=503 bytes= protocol=https 2020-02-16T11:21:50.056406+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host= prime-blog1.herokuapp.com request_id=73be35df-b562-4721-963b-78d5dda5ecf8 fwd="106.215.214.236" dyno= connect= service= status=503 bytes= protocol=https — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#91?email_source=notifications&email_token=AKBSIYUPWJPOXVECWUIC73TRDEO53A5CNFSM4KPRJKFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL4ECSQ#issuecomment-586694986>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKBSIYRXX63HR26EOUNDSKDRDEO53ANCNFSM4KPRJKFA .

There is no extension in profile .

41alderson commented 4 years ago

If this ( https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- ) was the project you were trying to host on heroku,

I did it successfully ( https://test-blog41.herokuapp.com/ )

But the script itself has lot of problems. Here are the logs

Screenshot_2020-02-17-11-34-19-819_com termux

JayantS08 commented 4 years ago

I will share my profile once my classes are over , maybe the issue is in profile.

BTW is there something you changed in the code snippets,https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- this is my repository for the app

41alderson commented 4 years ago

I will share my profile once my classes are over , maybe the issue is in profile.

BTW is there something you changed in the code snippets,https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- this is my repository for the app

Add gunicorn to your requirements.txt Yeah i changed a bit in your config.py (secret_key) if you are getting from os.environ.get then you should configure the same in heroku

JayantS08 commented 4 years ago

I will share my profile once my classes are over , maybe the issue is in profile. BTW is there something you changed in the code snippets,https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- this is my repository for the app

Yeah i changed a bit in your config.py (secret_key) if you are getting from os.environ.get then you should configure the same in heroku

Yeah I did it , infact I stored account username pwd and sqlalchemy uri also in the config variables

41alderson commented 4 years ago

I will share my profile once my classes are over , maybe the issue is in profile. BTW is there something you changed in the code snippets,https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- this is my repository for the app

Yeah i changed a bit in your config.py (secret_key) if you are getting from os.environ.get then you should configure the same in heroku

Yeah I did it , infact I stored account username pwd and sqlalchemy uri also in the config variables

Install postgresql or mysql addon on heroku. And don't use sqlite3 as Heroku filesystem is ephemeral.

JayantS08 commented 4 years ago

I will share my profile once my classes are over , maybe the issue is in profile. BTW is there something you changed in the code snippets,https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- this is my repository for the app

Yeah i changed a bit in your config.py (secret_key) if you are getting from os.environ.get then you should configure the same in heroku

Yeah I did it , infact I stored account username pwd and sqlalchemy uri also in the config variables

Install postgresql or mysql addon on heroku. And don't use sqlite3 as Heroku filesystem is ephemeral.

Okk I will try this today . Thanks for the advice

JayantS08 commented 4 years ago

I will share my profile once my classes are over , maybe the issue is in profile. BTW is there something you changed in the code snippets,https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- this is my repository for the app

Yeah i changed a bit in your config.py (secret_key) if you are getting from os.environ.get then you should configure the same in heroku

Yeah I did it , infact I stored account username pwd and sqlalchemy uri also in the config variables

Install postgresql or mysql addon on heroku. And don't use sqlite3 as Heroku filesystem is ephemeral.

Okk I will try this today . Thanks for the advice

Should I change my config.py for postgresql Fir eg. port and uri

41alderson commented 4 years ago

I will share my profile once my classes are over , maybe the issue is in profile. BTW is there something you changed in the code snippets,https://github.com/jayant-prime/Flask_APP-a-blog-posting-app- this is my repository for the app

Yeah i changed a bit in your config.py (secret_key) if you are getting from os.environ.get then you should configure the same in heroku

Yeah I did it , infact I stored account username pwd and sqlalchemy uri also in the config variables

Install postgresql or mysql addon on heroku. And don't use sqlite3 as Heroku filesystem is ephemeral.

Okk I will try this today . Thanks for the advice

Should I change my config.py for postgresql Fir eg. port and uri

Nope once you have installed heroku postgresql, Then goto app settings, There click on reveal config vars. You will get something Like DATABASE_URL (change your sqlalchemy_database_uri in config.py to DATABASE_URL). You can add your secret_key in herokus config vars .

JayantS08 commented 4 years ago

web:gunicorn run:app

this is the content of my procfile

i also changed my database URI to the postgre SQL URL and added secret_key in my config vars

these are my logs now :

2020-02-16T11:17:49.946962+00:00 app[api]: Release v1 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:49.946962+00:00 app[api]: Initial release by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Release v2 created by user jayant.singh0801@gmail.com 2020-02-16T11:17:50.066725+00:00 app[api]: Enable Logplex by user jayant.singh0801@gmail.com 2020-02-16T11:20:58.000000+00:00 app[api]: Build started by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Release v3 created by user jayant.singh0801@gmail.com 2020-02-16T11:21:37.887085+00:00 app[api]: Deploy 2be0be17 by user jayant.singh0801@gmail.com 2020-02-16T11:21:47.000000+00:00 app[api]: Build succeeded 2020-02-16T11:21:49.442656+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=prime-blog1.herokuapp.com request_id=0b8d5dc0-9fce-403e-b56f-ec5ab860d042 fwd="106.215.149.44" dyno= connect= service= status=503 bytes= protocol=https 2020-02-16T11:21:50.056406+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=prime-blog1.herokuapp.com request_id=73be35df-b562-4721-963b-78d5dda5ecf8 fwd="106.215.214.236" dyno= connect= service= status=503 bytes= protocol=https 2020-02-16T11:25:36.656332+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=prime-blog1.herokuapp.com request_id=c3f844ce-646e-45d6-a903-76bed72d2309 fwd="223.186.142.192" dyno= connect= service= status=503 bytes= protocol=http 2020-02-17T08:45:43.625001+00:00 app[api]: Running release v4 commands by user jayant.singh0801@gmail.com 2020-02-17T08:45:43.637256+00:00 app[api]: @ref:postgresql-curly-39830 completed provisioning, setting DATABASE_URL. by user jayant.singh0801@gmail.com 2020-02-17T08:45:43.625001+00:00 app[api]: Attach DATABASE (@ref:postgresql-curly-39830) by user jayant.singh0801@gmail.com 2020-02-17T08:45:43.637256+00:00 app[api]: Release v5 created by user jayant.singh0801@gmail.com 2020-02-17T09:02:48.577358+00:00 app[api]: Set SECRET_KEY config vars by user jayant.singh0801@gmail.com 2020-02-17T09:02:48.577358+00:00 app[api]: Release v6 created by user jayant.singh0801@gmail.com 2020-02-17T09:03:54.000000+00:00 app[api]: Build started by user jayant.singh0801@gmail.com 2020-02-17T09:04:37.936945+00:00 app[api]: Release v7 created by user jayant.singh0801@gmail.com 2020-02-17T09:04:37.936945+00:00 app[api]: Deploy e3446895 by user jayant.singh0801@gmail.com 2020-02-17T09:04:47.000000+00:00 app[api]: Build succeeded 2020-02-17T09:04:53.139194+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=prime-blog1.herokuapp.com request_id=8748ba75-cca5-45d1-9e49-211287f5ff6a fwd="103.55.108.242" dyno= connect= service= status=503 bytes= protocol=https 2020-02-17T09:04:53.598931+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=prime-blog1.herokuapp.com request_id=53c351c7-4698-41a8-b971-d17b528ca75d fwd="103.55.108.242" dyno= connect= service= status=503 bytes= protocol=https Capture

41alderson commented 4 years ago

are you using heroku website or heroku-cli?

JayantS08 commented 4 years ago

are you using heroku website or heroku-cli?

I have installed Heroku CLI and now doing this all from CMD

41alderson commented 4 years ago

then enter "heroku ps:scale web=1" (without " ")

JayantS08 commented 4 years ago

then enter "heroku ps:scale web=1" (without " ")

Okk I will surely try that

JayantS08 commented 4 years ago

heroku ps:scale web=1

Couldn't find that process type (web).

this is what i got

41alderson commented 4 years ago

send your Procfile.

JayantS08 commented 4 years ago

send your Procfile.

web:gunicorn run:app