• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
导航菜单
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx
您的位置:首页 > 服务器 >windows > 企业里实现代码自动部署、回滚的解决方案——Caphub

企业里实现代码自动部署、回滚的解决方案——Caphub

作者:网友 字体:[增加 减小] 来源:互联网

本文主要包含企业erp解决,企业无线网络解决方案,小企业借贷难如何解决,帮助企业解决困难,企业网络安全解决方案等服务器相关知识,网友希望可以进行参考

上周给大家介绍了capistrano,它可以帮助我们来解决代码自动部署与回滚的软件,但这个软件还是有点缺点,比如如果你同时有多个项目的时候,就得创建多个目录,然后每次进行代码更新的时候,进入到不同的目录中去,十分的麻烦,所以本文介绍的caphub就是为了解决这个问题。

目录

一、简介

二、安装

三、测试

四、capistrano或caphub在企业里真实环境软件自动化部署需求

一、简介

Caphub是一个适合企业应用的自动化部署与回滚软件,他的好处为:

Main idea of caphub is separate deployment and application code. So instead of capify your each project create one caphub repository and put all configurations/recipes there.
Benefits:
no deployment/application code mix.
all deployment located in place.
ability to deploy multiple projects
deployment is not limited application deployment - deploy your system configurations too! (nginx/haproxy/etc configs)
easy to share configurations/recipes among multiple deployment.
uptodate synchronizing with remote repository (with capistrano-uptodate).
generate layout with caphub or write it yourself from scratch with your own recipes

简单的话,如果你有多个项目需要自动化部署的话,多个项目配置文件可以集中放在一个地方,caphub更适合解决这样问题。具体情况看下面的测试。

二、安装

本文的测试环境为ubuntu server 12.04

gem install caphub
caphub caphub_test
root@server:~/capistrano# tree --dirsfirst caphub_test/
caphub_test/
|-- config
|   |-- deploy
|   `-- deploy.rb
|-- recipes
|-- Capfile
|-- Gemfile
`-- Gemfile.lock

初始化gemsinitialize gems)

cd caphub_test
bundle install

安装完成后可以使用cap –vT查看任务信息

root@server:~/capistrano/caphub_test# cap -vT
cap deploy                   # Deploys your project.
cap deploy:check             # Test deployment dependencies.
cap deploy:cleanup           # Clean up old releases.
cap deploy:cold              # Deploys and starts a `cold' application.
cap deploy:create_symlink    # Updates the symlink to the most recently deployed version.
cap deploy:finalize_update   # [internal] Touches up the released code.
cap deploy:migrate           # Run the migrate rake task.
cap deploy:migrations        # Deploy and run pending migrations.
cap deploy:pending           # Displays the commits since your last deploy.
cap deploy:pending:diff      # Displays the `diff' since your last deploy.
cap deploy:restart           # Blank task exists as a hook into which to install your own environment specific behaviour.
cap deploy:rollback          # Rolls back to a previous version and restarts.
cap deploy:rollback:cleanup  # [internal] Removes the most recently deployed release.
cap deploy:rollback:code     # Rolls back to the previously deployed version.
cap deploy:rollback:revision # [internal] Points the current symlink at the previous revision.
cap deploy:setup             # Prepares one or more servers for deployment.
cap deploy:start             # Blank task exists as a hook into which to install your own environment specific behaviour.
cap deploy:stop              # Blank task exists as a hook into which to install your own environment specific behaviour.
cap deploy:symlink           # Deprecated API.
cap deploy:update            # Copies your project and updates the symlink.
cap deploy:update_code       # Copies your project to the remote servers.
cap deploy:upload            # Copy files to the currently deployed version.
cap deploy:web:disable       # Present a maintenance page to visitors.
cap deploy:web:enable        # Makes the application web-accessible again.
cap invoke                   # Invoke a single command on the remote servers.
cap multiconfig:ensure       # [internal] Ensure that a configuration has been selected
cap patch                    # Create, deliver and apply patch
cap patch:apply              # Apply patch
cap patch:create             # Create patch
cap patch:deliver            # Deliver patch
cap patch:revert             # Revert patch
cap shell                    # Begin an interactive Capistrano session.
cap uptodate                 # Automatically synchronize current repository
cap uptodate:git             #
Extended help may be available for these tasks.
Type `cap -e taskname' to view it.

由于当前没有创建都是空的

三、测试结合svn的部署

1、内容

先进入到deploy目录

root@server:~/capistrano/caphub_test# cd config/deploy
root@server:~/capistrano/caphub_test/config/deploy# ll
total 12
drwxr-xr-x 2 root root 4096 Jul 30 12:22 ./
drwxr-xr-x 3 root root 4096 Jul 30 10:18 ../
-rw-r--r-- 1 root root    0 Jul 30 10:18 .gitkeep

然后展示一下我的svn部署的内容

root@server:~/capistrano/caphub_test/config/deploy# cat svn.rb
set :application, "test_svn"
set :scm, :subversion
set :repository,  "https://192.168.1.56/svn/ops_manage"
set :scm_username, "denglei"
set :scm_password, "123456"
set :deploy_to, "/tmp/result_svn/ops_manage"
set :normalize_asset_timestamps, false
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
role :web, "192.168.56.101"                          # Your HTTP server, Apache/etc
role :app, "192.168.56.101"                          # This may ber
role :db,  "192.168.56.101", :primary => true # This is where Rails migrations will run
root@server:~/capistrano/caphub_test/config/deploy# ll /tmp/red
redis/                redis.pl              redmine-2.3.1/        redmine-2.3.1.tar.gz  redmine1.sql
root@server:~/capistrano/caphub_test/config/deploy# ll /tmp/red
redis/                redis.pl              redmine-2.3.1/        redmine-2.3.1.tar.gz  redmine1.sql

在看看我的tmp目录下是否有result_svn目录

root@server:~/capistrano/caphub_test/config/deploy# ll /tmp/result_svn
ls: cannot access /tmp/result_svn: No such file or directory

可以看到没有

然后在看看当前的任务信息

root@server:~/capistrano/caphub_test/config/deploy# cap -vT
cap deploy                   # Deploys your project.
cap deploy:check             # Test deployment dependencies.
cap deploy:cleanup           # Clean up old releases.
cap deploy:cold              # Deploys and starts a `cold' application.
cap deploy:create_symlink    # Updates the symlink to the most recently deployed version.
cap deploy:finalize_update   # [internal] Touches up the released code.
cap deploy:migrate           # Run the migrate rake task.
cap deploy:migrations        # Deploy and run pending migrations.
cap deploy:pending           # Displays the commits since your last deploy.
cap deploy:pending:diff      # Displays the `diff' since your last deploy.
cap deploy:restart           # Blank task exists as a hook into which to install your own environment specific behaviour.
cap deploy:rollback          # Rolls back to a previous version and restarts.
cap deploy:rollback:cleanup  # [internal] Removes the most recently deployed release.
cap deploy:rollback:code     # Rolls back to the previously deployed version.
cap deploy:rollback:revision # [internal] Points the current symlink at the previous revision.
cap deploy:setup             # Prepares one or more servers for deployment.
cap deploy:start             # Blank task exists as a hook into which to install your own environment specific behaviour.
cap deploy:stop              # Blank task exists as a hook into which to install your own environment specific behaviour.
cap deploy:symlink           # Deprecated API.
cap deploy:update            # Copies your project and updates the symlink.
cap deploy:update_code       # Copies your project to the remote servers.
cap deploy:upload            # Copy files to the currently 
  


 
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 企业里实现代码自动部署、回滚的解决方案——Caphub

相关文章

  • 如何在硬盘安装windows server 2008
  • windows服务器iis伪静态配置图解
  • Windows中配置Python运行环境,只有700KB
  • Windows 2003中IIS不支持FLV视频文件
  • 用户 NT AUTHORITY\NETWORK SERVICE登录失败解决方法
  • .htaccess重定向和url重写
  • Windows Server 2008 修改密码策略的方法
  • 无法打开用户默认数据库的解决方法
  • Windows IIS如何设置CDN的CACHE过期时间
  • EPG服务器节目单更新私有描述符

文章分类

  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx

最近更新的内容

    • 如何查看Windows服务所对应的端口?
    • 在Windows 2008上部署Exchange 2007
    • 谈谈重复数据删除
    • 让apache/iis服务器支持wap站点方法
    • Windows2003安装SQL2005的SP1补丁无法安装
    • 在登录到域中的计算机上修改时间,并且此时间不被DC同步方法
    • iis备份(MetaBase.xml)重装系统后怎么恢复
    • 中小企业开源存储方案演变详解
    • nginx图片防盗链
    • 自己动手修改WinPE的boot.wim的全过程

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有