Rails

使用Dockerfile构建Docker镜像

蓝咒 提交于 2019-12-04 07:46:33
目录 前言 Dockerfile的书写规则及指令使用方法 创建Dockerfile,构建运行环境 构建镜像 Dockerfile参考示例 Dockerfile最佳实践 1. 前言 Dockfile是一种被Docker程序解释的脚本,Dockerfile由一条一条的指令组成,每条指令对应Linux下面的一条命令。Docker程序将这些Dockerfile指令翻译真正的Linux命令。Dockerfile有自己书写格式和支持的命令,Docker程序解决这些命令间的依赖关系,类似于Makefile。Docker程序将读取Dockerfile,根据指令生成定制的image。相比image这种黑盒子,Dockerfile这种显而易见的脚本更容易被使用者接受,它明确的表明image是怎么产生的。有了Dockerfile,当我们需要定制自己额外的需求时,只需在Dockerfile上添加或者修改指令,重新生成image即可,省去了敲命令的麻烦。 2. Dockerfile的书写规则及指令使用方法 Dockerfile的指令是忽略大小写的,建议使用大写,使用 # 作为注释,每一行只支持一条指令,每条指令可以携带多个参数。 Dockerfile的指令根据作用可以分为两种, 构建指令和设置指令 。构建指令用于构建image,其指定的操作不会在运行image的容器上执行;设置指令用于设置image的属性

gitlab仓库

為{幸葍}努か 提交于 2019-12-04 07:15:08
目录 1.本章课程内容大纲 2.gitlab安装 2.1 配置gitlab的url 2.2 配置gitlab的邮箱 2.3关闭不用的程序 2.4 gitlab初始化 2.5 访问gitlab服务 2.6 验证邮箱功能是否可用 3.gitlab汉化 4.gitlab日常使用 1.git修改为ssh连接方式 2.gitlab备份 3.gitlab恢复 4.gitlab升级 5.gitlab迁移 5.gitlab总结 1.本章课程内容大纲 1.Gitlab版本库基本概述   1.什么是gitlab?   2.gitlab与github的不同?   3.为什么使用gitlab优势和使用场景? 2.Gitlab服务组成? 3.gitlab安装配置?   1.安装gitlab   2.配置gitlab访问域名   3.配置gitlab邮箱信息 4.gitlab中文汉化? 5.gitlab日常使用?   1.Gitlab中的用户、用户组、项目仓库之间的关系?   2.创建组、创建用户、创建项目?   3.验证用户、组、项目的相关权限?   3.如何将本地的本数据推送至gitlab的仓库? http方式、ssh方式?   4.如果有新成员需要加入该项目该怎么办? 6.gitlab运维,如何备份、恢复、升级? gitlab介绍: 代码托管仓库,和gitee github 等等 2

centos 安装ruby on rails +mysql 环境搭建

这一生的挚爱 提交于 2019-12-04 03:07:39
安装环境 centos 5.5 1、更新centos源 cd /etc/yum.repos.d mv CentOS-Base.repo CentOS-Base.repo.save wget http://mirrors.163.com/.help/CentOS-Base-163.repo yum makecache 2、安装准备工作 yum -y install gcc* yum -y install gcc-c++* yum -y install curses-devel* yum -y install curses* yum install -y cmake bison bash yum install curl yum install curl-devel yum install zlib-devel yum install openssl-devel yum install perl yum install cpio yum install expat-devel yum install gettext-devel yum install autoconf yum install sqlite* yum install ruby-devel sqlite-devel yum install ntp* 3、安装mysql groupadd mysql useradd -g

解决rails报错:Webpacker::Manifest::MissingEntryError in Projects#index

北城以北 提交于 2019-12-03 20:33:34
报错信息: Webpacker can't find application.js in .../app/public/packs/manifest.json. Possible causes: 1. You want to set webpacker.yml value of compile to true for your environment unless you are using the `webpack -w` or the webpack-dev-server. 2. webpack has not yet re-run to reflect updates. 3. You have misconfigured Webpacker's config/webpacker.yml file. 4. Your webpack configuration is not creating a manifest. Your manifest contains: { } 报错原因:node.js版本太低 在用rails new project_name命令生成项目目录时会看到一个node.js版本警告信息(项目生成时注意看命令行的打印信息,后面新建一个项目时才看到) 1. 更新node.js 1.1 输入命令 sudo npm config set registry https:

How to connect to Microsoft sql server2005 from rails on linux(centos5)

▼魔方 西西 提交于 2019-12-03 18:32:05
Assumed: ruby 1.8.6 rails : 2.2.2 centos5 64bit sqlserver2005 Required: unixODBC >= 2.2.11 ( http://www.unixodbc.org/ ) FreeTDS >= 0.63 ( http://www.freetds.org/ ) Ruby ODBC >= 0.996 ( http://www.ch-werner.de/rubyodbc/ ) Ruby DBI >= 0.0.23 ( http://ruby-dbi.sourceforge.net/ ) First: Use ~/.bashrc for your local profile or /etc/profile to set this for all users. export ODBCINI=/etc/odbc.ini export ODBCSYSINI=/etc export FREETDSCONF=/etc/freetds/freetds.conf install unixODBC: apt-get install unixODBC or yum install unixODBC but I am use rpm,like this: rpm -ivh unixODBC-2.2.11-7.1.x86_64.rpm you

mac系统ruby on rails开发环境搭建

房东的猫 提交于 2019-12-03 18:31:46
mac系统ruby使用rvm隔离开发环境 安装rvm $ curl -L https://get.rvm.io | bash -s stable 这会在~/.profile添加如下代码 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 这时,每次打开shell会话,都有如下输出 $ which rvm /Users/apple/.rvm/bin/rvm 安装ruby指定的版本 $ rvm install 2.2.2 3.创建gemset $ rvm use 2.2.2 $ rvm gemset create name 4.切换gemset $ rvm use 2.2.2 $ rvm gemset use name 5.安装bundle $ gem install bundle 6.根据Gemfile创建项目的依赖包 $ cd path/to/project $ ./bin/bundle install 7.执行数据库迁移 $ cd path/to/project $ ./bin/rake db:migrate 8.启动服务 $ cd path/to/project $ ./bin/rails server 来源: oschina 链接: https://my.oschina.net/u

如何异步上传文件?

坚强是说给别人听的谎言 提交于 2019-12-03 18:12:15
我想用jQuery异步上传文件。 这是我的HTML: <span>File</span> <input type="file" id="file" name="file" size="10"/> <input id="uploadbutton" type="button" value="Upload"/> 这是我的jQuery代码: $(document).ready(function () { $("#uploadbutton").click(function () { var filename = $("#file").val(); $.ajax({ type: "POST", url: "addFile.do", enctype: 'multipart/form-data', data: { file: filename }, success: function () { alert("Data Uploaded: "); } }); }); }); 我只获取文件名,而不是上传文件。 我该怎么做才能解决此问题? #1楼 我已经在Rails环境中编写了此代码 。 如果您使用轻量级的jQuery-form插件,则仅包含五行JavaScript。 挑战在于如何使AJAX上传工作,因为标准 remote_form_for 无法理解多部分表单提交。

Ruby on Rails服务器文件上传

女生的网名这么多〃 提交于 2019-12-03 10:24:29
最近看了下ruby on rails,试着把 Dynamic Web TWAIN 集成到ruby on rails中。这里分享下如何在rails中用几行代码搞定文件上传。 参考原文: How to Load, Scan and Upload Files with Ruby on Rails 作者: Desmond Shaw 翻译: yushulx 软件安装 Dynamic Web TWAIN 11.1 Ruby 2.1.7 Ruby Development Kit 在Windows上不要选择Ruby 2.2,不然在运行rails server的时候会报错: nokogiri不支持,详情可以阅读 https://github.com/sparklemotion/nokogiri/issues/1256 。 Rails创建工程的基本步骤 安装rails: gem install rails 创建应用: rails new dwt cd到dwt 启动服务 rails server 访问 http://localhost:3000 Rails集成Dynamic Web TWAIN上传文件 创建controller rails generate controller twainscanning home 把 < Dynamic Web TWAIN directory >\Resources

Ruby on Rails gem &#039;byebug&#039; installing error

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I fix this error? This issue is created when I check the rails version in a demo created website using this command. 回答1: you can also use another debugger gem 'pry', '0.9.12.6' and remove gem 'byebug' . Then run bundle install 回答2: The output in yellow is asking you to run bundle install instead of gem install You should do that. Update: It looks like the windows version build is failing. Only passes for ruby 2.0.0 but not for above versions. You can check the status at byebug's github project and the windows build status 回答3: The

Ruby on Rails Models. Why does a decimal{2,1} with scope 1 allow more than digit after the decimal point?

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having an issue with a table accepting too many digits after the decimal, despite defining it's precision and scope. rails generate model Hotel name:string 'rating:decimal{2,1}' class CreateHotels < ActiveRecord::Migration def change create_table :hotels do |t| t.string :name t.decimal :rating, precision: 2, scale: 1 t.timestamps end end end However, I am able to do the following. Hotel.create!(name: “The Holiday Inn”, rating: 3.75) Additionally, I have a rooms table (Room model), with t.decimal :rate, precision: 5, scale: 2 #this holds