fossasia / engelsystem

Shift planning system for events.
http://engelsystem.de
GNU General Public License v2.0
1.51k stars 31 forks source link

Automatic deployment to Heroku from development branch #136

Open hongquan opened 8 years ago

hongquan commented 8 years ago

Parent: #135

The website on Heroku will play role of staging server.

Reference: https://devcenter.heroku.com/articles/github-integration#automatic-deploys

sreejakshetty commented 8 years ago

@hongquan I am unable to do automatic deployment. screenshot from 2016-06-24 18 59 15

mariobehling commented 8 years ago

I gave you admin access. Please try again.

DishantK1807 commented 8 years ago

@hongquan : I was able to set development on Heroku. capture2

but when I open the app it shows forbidden access. capture

DishantK1807 commented 8 years ago

@kamishettysreeja25 : https://devcenter.heroku.com/articles/php-support#activation We can use this for help.

mariobehling commented 8 years ago

@kamishettysreeja25 Please give @rafalkowalski access

rafalkowalski commented 8 years ago

@DishantK1807 i also got the same error have you tried to configure Procfile file? I don't know PHP enough, maybe this can help you https://devcenter.heroku.com/articles/deploying-php#configuring-the-document-root

aviaryan commented 8 years ago

From Heroku PHP docs

Heroku PHP Support will be applied to applications only when the application has a file named composer.json in the root directory. Even if an application has no Composer dependencies, it must include an empty composer.json in order to be recognized as a PHP application.

So please add a blank composer.json to the root of this repo

Then as @rafalkowalski said, add a Procfile to the root. If the project's index.php is in public/ directory, it should have the following contents ..

web: vendor/bin/heroku-php-apache2 public/

Then you will have to setup Database on Heroku. Assuming you are using Mysql, follow this guide https://devcenter.heroku.com/articles/cleardb . Then to further use that database in php, see https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-php

Hope it helps.

sreejakshetty commented 8 years ago

Hi @aviaryan

So please add a blank composer.json to the root of this repo

We are deploying development branch. composer.json file exits in the development branch.

Then as @rafalkowalski said, add a Procfile to the root. If the project's index.php is in public/ directory, it should have the following contents .. Then you will have to setup Database on Heroku. Assuming you are using Mysql, follow this guide https://devcenter.heroku.com/articles/cleardb . Then to further use that database in php, see https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-php Hope it helps.

Sure , Thanks I will try adding Procfile. I think I have missed that .

DishantK1807 commented 8 years ago

Followed the steps mentioned, added the Procfile to update the document root, updated the database using cleardb, the app is deployed successfully but no content is viewed. capture

sreejakshetty commented 8 years ago

@DishantK1807 can you share your config/config.php We need to remove config/config.php from .gitignore as we can't copy the config.default.php to config.php on heroku to setup the system.

DishantK1807 commented 8 years ago

@kamishettysreeja25: I am away from my laptop right now. Can you take it from my forked repository? from the dev branch.

On Tue, Jun 28, 2016 at 1:12 PM, kamishetty sreeja <notifications@github.com

wrote:

@DishantK1807 https://github.com/DishantK1807 can you share your config.php file. We need to remove config/config.php from .gitignore as we can't copy the config.default.php to config.php on heroku to setup the system.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fossasia/engelsystem/issues/136#issuecomment-228975418, or mute the thread https://github.com/notifications/unsubscribe/AHdzR19MbDV7X-5_VzMIJyEfmI9uZsq-ks5qQNBTgaJpZM4I9qnQ .

Dishant Khanna Student Developer,* Google Summer of Code* Web Developer, Human Circle

_Linke_dIn: https://in.linkedin.com/in/dishantkhanna

sreejakshetty commented 8 years ago

@DishantK1807 . We need to change the configuration of config.php. https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-php

$url = parse_url(getenv("CLEARDB_DATABASE_URL"));
$server = $url["host"];
$username = $url["user"];
$password = $url["pass"];
$db = substr($url["path"], 1);

$config = array(
    'host' => $server ,
    'user' => $username ,
    'pw' => $password,
    'db' => $db 
);

I have added the following lines.But even after changing config.php file I am unable to view .

aviaryan commented 8 years ago

@kamishettysreeja25 Have you created clearDB database on heroku ? heroku addons:create cleardb:ignite

sreejakshetty commented 8 years ago

@aviaryan ,yes I have created clearDB database on heroku and imported the tables. I deployed a sample php and mysql project following the same steps as I followed for engelsystem the sample project is successfully running but I am unable to view engelsystem.https://glacial-meadow-29445.herokuapp.com/index.php

sreejakshetty commented 8 years ago

https://arcane-temple-12164.herokuapp.com/ I have again tried deploying but the same result I am unable to even view the page. Did anyone fix it ?

sreejakshetty commented 8 years ago

From heroku logs we are getting this error

You're page is returning a server error, http 500, looking at your logs with heroku logs I see:
2016-06-28T13:07:17.962936+00:00 app[web.1]: [28-Jun-2016 13:07:17 UTC] PHP Fatal error:  Call to undefined function _() in /app/includes/view/User_view.php on line 8
2016-06-28T13:07:17.977512+00:00 heroku[router]: at=info method=GET path="/" host=arcane-temple-12164.herokuapp.com request_id=04b842cc-8caa-4580-91df-5bc5a3d81518 fwd="81.102.218.46" dyno=web.1 connect=0ms service=1ms status=500 bytes=189
hongquan commented 8 years ago

Call to undefined function _()

This means the PHP on Heroku doesn't have gettext library. You can ask Heroku to add missing library by composer.json file.

sreejakshetty commented 8 years ago

@hongquan how can we do it just adding the library for gettext library. Even after removing the line I am getting the same log error. I have mailed the heroku support regarding this.

hongquan commented 8 years ago

You already have "keyword". Quick Google can give a solution http://stackoverflow.com/questions/32303089/how-to-install-gettext-extension-for-php-on-heroku

Even after removing the line

Which line?

sreejakshetty commented 8 years ago

line no 8 2016-06-28T13:07:04.001258+00:00 app[web.1]: [28-Jun-2016 13:07:03 UTC] PHP Fatal error: Call to undefined function _() in /app/includes/view/User_view.php on line 8

hongquan commented 8 years ago

Don't you understand what "Call to undefined function" mean? It means that that line of code contains some undefined function. And it also means that this undefined function may also occurs in other lines (because we, the author of the code, are using that function). So, removing only line 8 doesn't mean that the use of that undefined function will completely disappear from our code.

When you read the log message, please look in to the code, at that line, to understand the problem.

sreejakshetty commented 8 years ago

I have fixed it https://arcane-temple-12164.herokuapp.com/ I will be changing the domain name and add automatic deployment to development branch. Cheers!

sreejakshetty commented 8 years ago

screenshot from 2016-06-28 20 46 59 enabled automatic deploy from development branch

sreejakshetty commented 8 years ago

screenshot from 2016-06-29 19 25 30 Added the domain name but unable to load the site fossasia.engel.com

mariobehling commented 8 years ago

@kamishettysreeja25 Do you own the domain engel.com? Of course this should not work. I suggest you think this through yourself.

sreejakshetty commented 8 years ago

I don't own the domain name. https://devcenter.heroku.com/articles/custom-domains I understood the reason. Thank you

sreejakshetty commented 8 years ago

changed the heroku domain name successfully new link : http://engelsystem-foss.herokuapp.com/

sreejakshetty commented 8 years ago

Documentation for deploying php and mysql app on heroku. https://codelifefungsoc16.wordpress.com/2016/06/30/deploying-php-and-mysql-app-on-heroku/

hongquan commented 8 years ago

@kamishettysreeja25 Duplicate of require key in composer.json:

   "require": {
    "ext-mysql": "*"
  },
   "require": {
      "ext-gettext": "*"
    },
sreejakshetty commented 8 years ago

@hongquan I have updated the composer.json file. Removed the duplicate require key. https://github.com/fossasia/engelsystem/commit/59c15c38d2f0a476e3e80bbadee5ac0484ee674d Thank you.

mariobehling commented 8 years ago

Deployed here http://volunteersys.herokuapp.com

mariobehling commented 8 years ago

Unfortunately this issue needs to be re-opened as the system is not deployed after an update properly. The priority was urgent 1.5 months ago and is not solved yet entirely.