Skip to content
This repository

Add linux support #8

Closed
pkeenatemma opened this Issue May 22, 2012 · 9 comments

6 participants

pkeenatemma Pete Keen Drew Ulmer Jarred Sumner Daniel Alan Miller Popa Marius Adrian
pkeenatemma

This should just amount to writing out a different thing instead of a LaunchDaemon. On ubuntu, an upstart. On other machines, an init.d style script probably.

Drew Ulmer

Can I throw a quick +1 on this? This is a very neat project you've put together here, Pete! I'm very much looking forward to seeing Linux support so I can give it a try.

Jarred Sumner

I'm +1'ing this as well.

Capistrano delpoyment works, but it's still frustrating and complicated to setup and manage. It'd be awesome if there was something that I could just run:

 dokuen new $DOMAIN --server $SERVER_IP # Authenticated with SSH Key
 git push production

and my app is delpoyed to my VPS/Dedicated Server.

Note, the key here is not just that it configures these things, but that it also compiles/installs things as needed. Meaning that, for example, if I don't have PostgreSQL installed, it'll go ahead and compile it for me. Or, if I don't have Nginx installed, it'll take care of that for me as well. Sort of like what Rubber does, but not dependent on Amazon EC2.

I think it could detect whether or not X is installed by checking if it's binaries are in the $PATH. Although, this would be very complex.

The first command would create a directory for that domain, an entry in Nginx, an entry in an upstart/rc.conf/LaunchDaemon, a PostgreSQL database for that domain, and anything else that I'm not thinking of that'd be needed.

The second command, after pushing, would run

export RAILS_ENV=production
bundle install --deployment
bundle exec rake db:migrate
bundle exec rake assets:precompile

and anything else needed.

I'd be down to put some time into this.

Pete Keen
Owner

@Jarred-Sumner That's maybe outside the purview of something like Dokuen? That territory is pretty adequately covered by something like Chef. I can see some integration with Chef, though, where you could maybe have a list of recipes checked in, kind of like a Gemfile, and then at push-time Dokuen would attempt to install those recipes.

Jarred Sumner

@peterkeen The problem with tools like Chef and Puppet, as far as i've seen, is that they're overly powerful when you just want to deploy small app(s) to a single dedicated/virtual server. Those seem like tools for system administration, whereas Heroku handles the application server, database, and many other things. Capistrano would work, but it's still frustrating to use because it just does deployment. It won't, without lots of configuration, create the database, add a user for each app, add the app to the Nginx configuration file, or any other things that are needed before deploying a new app.

I'd like something that does everything, but for small-scale apps hosted on a VPS or dediacted server. That's definitely a large undertaking, but Heroku is awesome because it does everything.

In any case, keep up the good work man.

Pete Keen
Owner

@Jarred-Sumner Take a look at the librarian project, specifically librarian-chef. That's kind of what I'm thinking of. In your app, you have a Cheffile that outlines the things you want installed at the system level. When you push, Dokuen sees that you have a Cheffile and runs librarian-chef and then chef install (or something like that).

Another thing I'm thinking about is Add-ons (#9) which very well could take care of that stuff. For example, a postgresql addon would install postgres itself. In the provision script it would create a database for your application and then set DATABASE_URL for you.

I'm investigating creating a user for each application automatically (see #10)

Daniel Alan Miller

If this turned into some sort of Ubuntu package (and also .rpm for my workplace) it would be an amazingly awesome tool.

Popa Marius Adrian
mariuz commented May 24, 2012

I think it might be useful to use it with juju on ubuntu https://juju.ubuntu.com/docs/getting-started.html#introduction
it can create new machines on ec2, local lxc and deploy some apps : nginx , rails

Jarred Sumner

@peterkeen That's an intersting project, it appears to make what I was talking about much easier to create.

But, it seems as though we have diferent ideas as to what this project should be. Here's how I'd like deployment to go for my VPS:

Initial Setup (on VPS):

sudo apt-get install dokuen
sudo dokuen setup

To which it'd reply:



We'll set you up with the default stack. If this isn't what you want, then just Ctrl-C out and run douken setup --help. Note that all software is installed in the namespace, so we won't be using system versions for any of these. This'll take a bit, so go grab yourself a cup of coffee.

Here's what that looks like:
     Database:              PostgreSQL
     Application Server:  Unicorn
     Web Server:           Nginx
     Git Hosting:            Gitolite (github:"sitaramc/gitolite")
     Ruby:                    1.9.3 p194 (with RVM)     
     User for every app: Yes
     Deploy User:          Yes
     DB for every app:    Yes                  


Downloading PostgreSQL...................................................................................................................................................................
Installing PostgreSQL.............................................................
Configuring PostgreSQL........................................
Downloading Nginx...............................................................
Installing Nginx.............................................................
Downloading RVM....................................................
Installing Ruby 1.9.3-p194 using RVM....................................................
Downloading Unicorn..................................
Configuring Nginx...........................
Configuring Unicorn........................
Downloading Gitolite........................................
Configuring Gitolite.......................................
Adding a deploy user...........................
Setting correct permissions..........................

Alright! You're good to go!

Here's the current status, you can find this anytime by running "douken status", which runs "douken stack status" and "douken apps status"

Here's the status of your stack:
      PostgreSQL: Running on Port 3306, open to localhost
      Nginx:          Running on Port 80, visible to world
      Unicorn:       Running, accessible via sockets
      Gitolite:        Running on Port 3000
      Ruby:           1.9.3-p194   

Here's the status of your apps:
      Demo App:    Running on http://my-awesome-demo-app.com. 0 errors so far.

Well, that's everything.

Now, when you want to setup a project, just run douken new in the project's directory.

cd my_project
douken new --domain my-awesome-app.com --server 192.168.1.1
Welcome to Douken. I've detected that this is a Ruby on Rails application.

I've got some notes specific to Ruby on Rails apps:

You can find a URL to the production database at the environment variable, "PRODUCTION_DB_MY_PROJECT"

Here's an example database.yml
   $EXAMPLE_DATABASE_YML [I'm on the train while writing this, I don't have access to an actual database.yml file at the moment]

When you're ready to deploy, just run git push douken master. I'll compile your assets, run bundle install, run your migrations (if neccessary), and make it nice for you. You can also update this way.

If I detect any errors, we'll rollback to the previous version of the app.

These settings were saved to your Doukenfile, feel free to change it there.
git push dokuen master

Then it replies with something like:

Pushing to server... [ I'm writing this on a computer that doesn't have a git installed and I'm on the train. Otherwise I'd have put the actual output git push does]

Hey! I noticed this is the first time you pushed the app!

I'll have to do some configuration before getting to the good stuff.

Adding my-project to Nginx.....................
Creating an upstart daemon to run this project on startup....
Creating the production database........................

Running bundler......
Compiling assets.....
Running migrations......
Restarting unicorn..........

Hey, Everything worked! Your server is running at my-awesome-app.com

This is what I think when I hear of a self-hosted PaaS. I think I'll put an hour or two a week into creating this.

Pete Keen
Owner

Basic linux support available as of v0.0.9

Pete Keen peterkeen closed this June 02, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.