Report this

What is the reason for this report?

Dokku and NodeJS + AngularJS Apps

Posted on October 24, 2014

Hi

We’re new to DO and we are deploying a set of apps that use Node for API and Angular for frontend code, and we’re using Dokku as the app container. We are facing a bit of difficulty because of the lack of Dokku documentation, but since there seams to be a lot of people using Dokku with DO maybe someone can help us.

1 - We run bower install in the post install script (so to not have bower components in git), and since we have node as a layer between nginx and the browser it supplies te frontend code as well using a “static” route. The problem is that the components downloaded during the post install seem to have a “special” state that prevents them from being access via http request. We canot fully understand what is wrong, but the solution is to just touch the files after the down load, so we put this in the post install script && find ./frontend -exec touch {} \; . This works but we would like to understand why. Does anyone have any idea? 2 - During the setup of the build process we had to install SASS by hand in the app container, but of course it doesn’t stick, so we put gem install sass in the post install as well. Is there a way to do this better? 3 - Is there a way to defined the version of mongodb that gets install using the mongodb plugin, and it there a way to externally connect to a mongodb instance?

Thanks in advance for your help

Ricardo Gomes



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

The bower issue does seem very strange. When you say that the resources can not be accessed via HTTP request, what exactly is the error? Just 404? Can you reproduce it using the dokku-bower-install plugin? It simply injects a script that is run in the “pre-deploy” phase:

#!/bin/bash

cd /app
PATH=\$PATH:/app/vendor/node/bin
if [[ -f ./bower.json ]]; then
	npm install -g bower && bower install --allow-root
fi

I’m not sure why that would work but your approach wouldn’t, but it might rule some things out…

As for connecting to an external MongoDB, if you app respects environmental variables you should be able to pass them into the container using:

dokku config:set <app> KEY1=VALUE1

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.