How to deploy/run Sinatra app on Mac via Passenger? - macos

We have a git server running on Gitosis hosting our projects. We have created an interface to display info about our repos, and now need to deploy it to the Mac running gitosis. The files for the Sinatra app need to reside in the /Users/git/repositories folder, but we would also like the Sinatra app to start running whenever the master branch is updated.
Is there a tool specifically for deploying on a Mac/example of a Git hook that will deploy in this manner?
We are looking for the simplest deploy possible. I'm assuming it will run on apache and we'll need to add a virtual host....
EDIT: Passenger Pane looks interesting...anyone use it for this? Also, I suppose the files could reside in our existing Library/WebServer/Documents location and just reference the gitosis repos, given no permissions issues

If i understood your issue correctly, then
to deploy try include the following to apache config:
Alias /gitosis "/Users/git/repositories/public"
#YOU HAVE TO ln -s /Users/git/repositories/public /Library/WebServer/Documents/gitosis
<Directory /Users/git/repositories/public>
RackBaseURI /gitosis
</Directory>
to restart just:
touch /Users/git/repositories/tmp/restart.txt

Related

How can I see the changes I make to a Go app running in Heroku local?

I admit I'm a GoLang newbie. In an attempt to learn Go, I developed an app about a year ago (based on the Heroku Getting started repository) and deployed it to Heroku. I used the heroku local server to develop it locally and deployed it successfully. Now I want to make some changes but I don't have the original source, so I have cloned the app from the Heroku repository.
I have got it running locally with the following steps:
export GOPATH=~/project_path
export GOBIN=$GOPATH/bin
go get
go install
heroku local
So far, so good. The problem is that when I make a simple change to the code in main.go, it doesn't show up in the browser. I've tried running go install and restarting the server after making the change but it makes no difference.
I've noticed that the file name in the Procfile is now incorrect (go-getting-started instead of the name of my project folder) but the server still runs and changing the name doesn't make any difference, locally at least. Same goes for the Dockerfile.
What am I doing wrong please?
Every time you make a change to a Go file in the project you need to run go install and stop and restart the heroku local server.
You might want to just run the server yourself with PORT=5000 go run main.go so that you only have to restart one thing. Or you can check out something like https://github.com/pilu/fresh which will listen to filesystem changes and restart your server for you.

Using laradock docker configuration for developing

Hello there we am currently developing a Laravel application. I want all my team members to work locally so we decided to use Docker for our local development environment. I did a little research and there is a project called laradock. After installing it I am supposed to go to http://localhost and the project should run. But I get this:
I am using apache2 and mysql
tl;dr
Go to ./laradock/.env and search for APACHE_DOCUMENT_ROOT then edit that line to this:
APACHE_DOCUMENT_ROOT=/var/www/public
Things to do after the change
For this change to take effect, you have to:
Rebuild the container: docker-compose build apache2
Restart the containers: docker-compose up
Explanation
As mentioned by simonvomeyser on GitHub this is a recent addition which had the same effect as rodion.arr's solution but this way you can leave the original config files untouched and use the .env file to store all your project related configurations. Obviously, since this is a docker config change, you have to rebuild and restart your container, as rodion-arr and 9bits ponted it out in the same thread.
Check you apache configuration (in my case [laradock_folder]/apache2/sites/default.apache.conf file).
You should have DocumentRoot /var/www/public/.
I suppose you have /var/www/ instead

How to setup Pydevd remote debugging with Heroku

According to this answer I am required to copy the pycharm-debug.egg file to my server, how do I accomplish this with a Heroku app so that I can remotely debug it using Pycharm?
Heroku doesn't expose the File system it uses for running web dyno to users. Means you can't copy the file to the server via ssh.
So, you can do this by following 2 ways:
The best possible way to do this, is by adding this egg file into requirements, so that during deployment it gets installed into the environment hence automatically added to python path. But this would require the package to be pip indexed
Or, Commit this file in your code base, hence when you deploy the file reaches the server.
Also, in the settings file of your project if using django , add this file to python path:
import sys
sys.path.append(relative/path/to/file)

heroku deployment with play framework 1.2.4 with own secure module

I have a play framework application (v1.2.4) to deploy to heroku.
I added secure module to my play app by copying the secure module from local PLAY_HOME. So that I could change Secure code to suit my project's needs.
Thus my folder structure looks like
work-root/
/play-project/ -> contains all play, libs & conf/application.conf
/secure/ -> copy of local secure module (& modified, which is why I copied. )
At the work-root, I did the following git operations:
git init
git add.
git commit -m 'first commmit with customised secure'
Please not that I didn't just commit from the play app folder (in play-project) but from a level above so that the custom secure app is also committed.
Then I created heroku app by
heroku create -s cedar --buildpack https://github.com/heroku/heroku-buildpack-pl
Which all worked.
to push code & have it deployed in heroku I did
git push heroku master
This didn't work,
~ Oops. conf/routes or conf/application.conf missing.
This is because they are not there but a level below.
I want to be able to tell Heroku that this is a play app the application.conf is in a "folder" called [play-project] & is within the current working directory.
Can someone please help me?
Many thanks Kind regards
--Rana Das
The default Play buildpack looks for those files. You can either fork the buildpack to make it work for your needs or you can switch to a more standard structure. To do what you want just go with a standard Play project layout (with the Play app in the root dir). Then for the secure module simply copy it's source into the modules/secure directory. Then Play will use your version of the module.

Deploying Django to Heroku using a Windows machine (Production server NOT development server)

I use a Windows machine and have a Django project that I have successfully deployed to Heroku, albeit using the development server. To use a production server Heroku seems to require 'Gunicorn' which does not run on Windows.
This is not good for testing locally before deploying. Does anyone know of any way to get around this? Perhaps some way to use a different server on Heroku?
I found a solution that may help when deploying to heroku using a Windows machine. Here is what I do:
Use the development server locally with:
python manage.py runserver
Install and add 'Gunicorn' to your installed apps in settings.py.
Add a process file in the root directory that tells heroku to use the Gunicorn server. This is a file called 'Procfile' with the following code:
web: python kalail/manage.py run_gunicorn --bind=0.0.0.0:$PORT
This way you test using the development server, while heroku uses the Gunicorn server. Make sure you set up serving static files(css/js/imgs) after this, because only the development server automatically serves static files, and the Gunicorn server will need to be configured to do so.
You can run the development server locally quite easily:
> python manage.py runserver
All you need to do is specify path to wsgi script from root directory:
$web: gunicorn hellodjango.wsgi

Resources