Setting Up Symfony Dev Environment in Heroku - macos

So as the title suggests, I am setting up a Symfony project in heroku. It is on my Mac OSX laptop. I followed the directions here to set it up. I got everything installed, pushed my project to heroku, tested it and it works on the web.
Now I'm trying to set up the local dev environment. I would like to be able to simply use heroku local to launch the dev server as usual. I installed the heroku php buildpack, and I created a Procfile with these contents:
web: $(composer config bin-dir)/heroku-php-apache2 web/
the composer config bin-dir command returns vendor/bin, and then I can see that heroku-php-apache2 file in there. Everything looks good.
When I run heroku local I get this error:
[WARN] No ENV file found
15:48:49 web.1 | This program requires Apache 2.4.10 or newer with mod_proxy and mod_proxy_fcgi enabled; check your 'httpd' command.
15:48:49 web.1 Exited with exit code 1
So I checked the httpd -v and I have:
Server version: Apache/2.4.27 (Unix)
Server built: Oct 3 2017 10:26:24
I just enabled (uncommented) mod_proxy and mod_proxy_fcgi in the /etc/apache2/httpd.conf file and restarted the machine, but still seeing the same error. I am starting to think it is a problem with my Procfile or something.
Any help is greatly appreciated.

For anyone having a similar problem, I was able to fix the issue. The issue WAS that I edited the wrong httpd.conf file, since I installed the apache from homebrew.
The path /etc/apache2/httpd.conf is correct if you are using the default apache2 installation on the mac. If you installed apache from homebrew like I did, you will find the httpd.conf file at /usr/local/etc/httpd/httpd.conf.
You need to uncomment the 2 lines for mod_proxy and mod_proxy_fcgi and also uncomment the port listener directive, since heroku likes to listen on non-default port 5000 and heroku will automatically do that at run time.
Also the server cannot be running already when you use heroku local.
:-)

Related

Missing "passenger.conf" Apache2

I am trying to deploy Redmine on my Ubuntu Linux server running Apache2. However, for my deployment of Redmine, I need to modify passenger.conf which is missing at the path /etc/apache2/mods-available/passenger.conf. I am wondering if this configuration file should have been provided during installation and how I can create this missing file?
If you need to configure passenger, then install using this ref link from phusion passenger official site
https://www.phusionpassenger.com/library/config/apache/intro.html

MODULE_NOT_FOUND in heroku pg:backups

I've got problem with heroku pg:backups capture --app myapp command.
Heroku CLI submits usage information back to Heroku. If you would like to disable this, set `skip_analytics: true` in /home/ubuntu/.heroku/config.json
heroku-cli: Updating to 4.99.0-e5f5ef4... done
heroku-cli: Updating CLI...heroku-cli: Updating to 5.11.8-f58f4fa... done
Starting backup of postgresql-spherical-5948... done
Use Ctrl-C at any time to stop monitoring progress; the backup will continue running.
Use heroku pg:backups:info to check progress.
Stop a running backup with heroku pg:backups:cancel.
Backing up DATABASE to b598... pending
Backing up DATABASE to b598... !
▸ MODULE_NOT_FOUND: Cannot find module 'bytes'
Does anybody have similar problem? This command is launched with deploy on CircleCI.
I started running into the same problem yesterday and was finally able to come up with a solution that is working for me.
For starters, it looks like bytes is a dependency of heroku-pg, which is the part of Heroku CLI that is being used for the backups command. It seems like the dependency is not being included or installed with the version of heroku-cli that is being used to run the backup command.
I tried CircleCI’s “Rebuild with SSH” to troubleshoot the issue, and encountered similar error messages when attempting the backup command there. While trying to reinstall heroku-cli using npm, I found that the npm and node versions were way behind what heroku-cli wanted, so maybe that is part of the problem? Anyway, reinstalling with npm only produced an even more broken Heroku CLI.
Finally I checked the build environment and it was set to Ubuntu 12.04 (Precise) which probably explains the way out of date npm/node packages. I changed it to Ubuntu 14.04 (Trusty) and pushed a new commit to CircleCI (A rebuild alone is not sufficient to change OS versions) and was able to successfully run the backup command that had been failing!
Solution: Set CircleCI build environment to Ubuntu 14.04

Which folder to keep projects for Homebrew nginx port 8080

I am using macbook and installed nginx using Homebrew from the terminal. I think i installed 2-3 versions of nginx in different locations. Now I can see my http://localhost:8080/ is working as it displays nginx home page in browser but how can I place my projects inside nginx? I tried to put those in one of the nginx directory but it does not work if if I try to go to project through browser.
Is there anything from where I can find the exact directory of this running version of nginx?
Use the brew list command:
$ brew list nginx
/usr/local/Cellar/nginx/1.10.1/bin/nginx
/usr/local/Cellar/nginx/1.10.1/homebrew.mxcl.nginx.plist
/usr/local/Cellar/nginx/1.10.1/html -> ../../../var/www
/usr/local/Cellar/nginx/1.10.1/share/man/man8/nginx.8
$ greadlink -f /usr/local/Cellar/nginx/1.10.1/html
/usr/local/var/www
Thus, the symlink links to /usr/local/var/www, and default configuration is likely to do likewise.

Heroku system cannot find path specified

I'm doing the tutorial on Heroku Dev Center (found here: https://devcenter.heroku.com/articles/getting-started-with-scala#introduction). I got through all the steps leading up to running my app locally (as far as I can tell the app is deployed properly and I have installed the app dependencies), but when I run the command 'heroku local web -f Procfile.windows' it gives me back an error on web.1 saying "the system cannot find the path specified"... I double checked that web.1 is up using 'heroku ps' command.
Help!
Seems to be related to the JDK version. I was trying to use JDK 10.0.1 and encountered the same problem. When I changed to point to JDK 1.8.0_121 which (I think) Heroku installed, I was able to continue.
The file specified at the Procfile.windows is not available, yet.
web: target\universal\stage\bin\play-getting-started.bat
To solve this, run:
sbt compile stage
in the root of the project directory to produce the required files.

Rails deployment using Phusion Passenger on Bluehost

I am trying to deploy a rails application on Bluehost using passenger and I have been failing all the time.
I installed the passenger gem using:
gem install passenger
And also ran:
passenger-install-apache2-module
And ran all my db migrations and also did a asset precompile
The problem is, I am trying to host it on a sub-domain, so I did the following steps:
Created a sub-domain.
Created a sym link from rails app pointing to the sub-domain.
Added the following lines to my .htaccess:
PassengerEnabled On
PassengerAppRoot /home/username/rails_apps/my_app
And when I navigate to my domain in the browser it gives me:
Internal Server Error.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#sub.domain.com
Where am I going wrong?
Thanks in advance :)
Hey have you checked user & group in your httpd conf file?
make sure that if you have user/group www-data in httpd conf then your project directories should have same owner & group.
I also tried doing the same thing, but was unsuccessful, but when I dig a bit deep I figured out following:
The apache server in Bluehost uses passenger in different path. Hence our installation would not affect it.
Passenger3.x of Bluehost is using ruby 1.8 as default one, hence the ruby version cannot be changed.
Check Bluehost on what needs to be in the .htaccess file.
Mine looks like this:
<IfModule mod_passenger.c>
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
RackBaseURI /home/rails_apps/my_app
SetEnv GEM_HOME /home/<my_bluehost_username>/ruby/gems
</IfModule>
You should use this command to find your ruby gems location:
gem env

Resources