Giter VIP home page Giter VIP logo

capidiem's Introduction

Deploying diem Applications with Capistrano

Capistrano is an open source tool for running scripts on multiple servers. It’s primary use is for easily deploying applications. While it was built specifically for deploying Rails apps, it’s pretty simple to customize it to deploy other types of applications. We’ve been working on creating a deployment “recipe” to work with diem applications to make our job a lot easier.

Prerequisites

  • Must have SSH access to the server you are deploying to.
  • Must have Ruby and RubyGems installed on your machine (not required for deployment server)’

Installing Capidiem

Through RubyGems.org

sudo gem install capidiem

Through GitHub

git clone [email protected]:elbouillon/capidiem.git
cd capidiem
gem build capidiem.gemspec
sudo gem install capidiem-{version}.gem

Setup your project to use Capidiem

CD to your project directory & run:

capidiem .

This will create Capfile in your project root & deploy.rb config file in config directory

Fill up your config/deploy.rb with your server connection data

Server Setup

Now, you can start the deployment process! To get your server setup with the file structure that Capistrano expects, you can run:

cap deploy:setup

This command will create the following folder structure on your server:

`-- /var/www/demo.everzet.com
  |-- current → /var/www/demo.everzet.com/releases/20100512131539
  |-- releases
    |-- 20100512131539
    |-- 20100509150741
    `-- 20100509145325
  `-- shared
    |-- log
    |-- config
      `-- databases.yml
    `-- web
      `-- uploads

The folders in the releases directory will be the actual deployed code, timestamped. Capistrano symlinks your log & web/uploads directories from your app to the directories in the shared folder so that it doesn’t get erased when you deploy a new version of your code.

To deploy your application, simply run:

cap deploy

Deployment

To configure database on production environment, run:

cap symfony:configure:database

To deploy your application for the first time, you can run:

cap deploy:cold

This will deploy your application, configures databases.yml (will ask you about DSN, user, pass), create the db, models, forms, filters, and run all of your migrations.

Now, whenever you need to deploy a new version of your code, just run:

cap deploy

Databases

If you need to dump remote database & download this dump to local backups/ folder, run:

cap database:dump:remote

If you need to dump local database & put this dump to local backups/ folder, run:

cap database:dump:local

If you need to dump remote database & populate this dump on local machine, run:

cap database:move:to_local

If you need to dump local database & populate this dump on remote server, run:

cap database:move:to_remote

Shared folders

If you need to download some shared folders from remote server, run:

cap shared:{databases OR log OR uploads]:to_local

If you need to upload some shared folders to remote server, run:

cap shared:{databases OR log OR uploads]:to_remote

Other tasks

If you need to deploy and run your migrations you can call:

cap deploy:migrations

We’ve also added a custom task to run your test suite on the production server. You can invoke this by calling:

cap deploy:tests:all

This will deploy the application, rebuild the test database, then run all of the tests.

Also, you have command to run your custom diem tasks:

cap symfony

If you want to see all of the Capistrano tasks available, you can run:

cap -T

We’ve been using this setup for a little while now, and it’s saved us a ton of time when we need to push changes for a site to the production server.

Contributors

capidiem's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

capidiem's Issues

ruby 1.9 required_location deprecated and removed

the new version of ruby (1.9) do not accept

Gem.required_location('capidiem', 'capidiem.rb')

so the "capidiem ." command should write in the Capfile (as capifony):

load Gem.find_files('capidiem.rb').last.to_s

not works ??

when i put capidiem . i become error (capidiem: command not found)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.