Question

I have deployed a Symfony2 app to Heroku with CHH heroku-buildpack-php.

After pushing the code to heroku, I use 'heroku run bash' to:
1) php app/console cache:clear --env=prod
2) php app/console assets:install --symlink
3) php app/console assetic:dump --env=prod

Anyhow, dumped assets on /web/bundles/... are not served and they show a 404 Not Found (I mean, each asset separately is not found). But for example, /web/favicon.ico is properly served to the client.

This is not happening in dev mode, in my localhost.

Could it be any permission issue on the server? Should I run those commands in Procfile, and how?

Thanks in advance.

Was it helpful?

Solution

Finally came up with the answer: Heroku does not allow you to modify the filesystem once deploy process is finished, so I used Profile file to tell Heroku to run a install.sh in which I run these commands.

Procfile looks like this:

    web: sh ./install.sh

And install.sh:

    php app/console cache:clear --env=prod
    php app/console assets:install --env=prod
    php app/console assetic:dump --env=prod
    php app/console doctrine:schema:update --force
    php app/console doctrine:fixtures:load --append
    sh ./bin/run

Last line is very important as it tells Heroku to procceed with the deploying process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top