我正在开发一本食谱来部署一个简单的基于jekyll的博客.我使用'application'cookbook作为基础.一切顺利,但厨师只是忽略了我定义的回调.
Chef日志包含有关我的回调的条目,但我看不到回调执行的错误或结果.
这是recipes/default.rb文件:
include_recipe "git"
application "example_com" do
path "/var/www/example.com"
repository "git@example.org:xxx/xxx.git"
revision "master"
deploy_key <<EOF
-----BEGIN RSA PRIVATE KEY-----
..skip...
-----END RSA PRIVATE KEY-----
EOF
# before_symlink "script/bootstrap"
before_deploy do
# raise
# Chef::Log.info("INSANE!")
execute "bundle exec rake generate" do
cwd release_path
end
end
end
Run Code Online (Sandbox Code Playgroud)
以下是chef-client表示执行before_deploy回调的日志:
[2012-10-06T10:06:20-04:00] INFO: Processing ruby_block[example_com before_deploy] action create (/var/cache/chef/cookbooks/application/providers/default.rb line 107)
[2012-10-06T10:06:20-04:00] DEBUG: Got callback before_deploy: #<Proc:0x00007f0509788088@/var/cache/chef/cookbooks/example_com/recipes/default.rb:24>
[2012-10-06T10:06:20-04:00] INFO: application[example_com] running callback before_deploy
[2012-10-06T10:06:20-04:00] INFO: ruby_block[example_com before_deploy] called
[2012-10-06T10:06:20-04:00] INFO: Processing deploy_revision[example_com] action deploy …Run Code Online (Sandbox Code Playgroud) 我搜索了很多,但找不到任何解决方案.在我的代码更改几个小时后,我尝试从php.net的例子,它的行为相同.
如果我把它发送到我的Gmail地址一切都很好看,如果我把它发送到另一台服务器,它不会将其作为HTML呈现.我尝试了大约8台服务器,其中4台遇到了这个问题
这是代码(php示例):
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . …Run Code Online (Sandbox Code Playgroud) 在使用谷歌分析注册时,需要在其中插入一段js脚本 base.html
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'xxx', 'example.com');
ga('send', 'pageview');
</script>
Run Code Online (Sandbox Code Playgroud)
让它始终存在的问题是,开发机器将提交不是来自真实用户的不必要数据.我想知道是否有办法询问烧瓶是否处于调试模式,因此不首先加载此脚本.
如何在模板中检查调试模式?
我一直在尝试设置Google Analytics,根据他们的网站,你应该只是将他们的脚本插入你的html页面.
我已经在开始标记之后将其添加到我的base.html.twig文件中.然后由layout.html.twig文件扩展,该文件由所有其他页面扩展.
这未显示为从Google Analytics页面安装的内容.标签显示在页面源中并被Ghostery阻止,但它仍然显示为Status: Tracking Not Installed.
我做错了什么,如何正确插入?
根据他们的说明 - 在</head>标签前粘贴:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'XX-XXXXXXXX-X', 'example.com');
ga('send', 'pageview');
</script>
Run Code Online (Sandbox Code Playgroud)
base.html.twig
<head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'XX-XXXXXXXX-X', 'example.com');
ga('send', 'pageview');
</script>
<meta charset="UTF-8"/>
<title>{% block title %}{% endblock %}</title>
{% block stylesheets %}
{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}"/>
</head>
Run Code Online (Sandbox Code Playgroud)
layout.html.twig
{% extends '::base.html.twig'%}
Run Code Online (Sandbox Code Playgroud) 我有这个查询字符串 www.example.com/yy?q=how+can+i+get+this&o=1&source=home
如何q使用javascript或jquery 解析数组中的参数值?
我想要像这样的数组
['how', 'can', 'i', 'get', 'this']
Run Code Online (Sandbox Code Playgroud) 有时我的Rails应用程序可能因任何错误而崩溃,并且在生产时访问特定URL时,有人可能会登陆/500.html页面.
一切都很正常.我们可以通过日志查看问题是什么然后修复.但是,为了正确查看页面,我们必须清除浏览器缓存,否则我们会再次重定向到/500.html
反正有没有阻止它?
我在下面描述一个示例工作流:
我们可以在Rails或Nginx配置中做些什么,这样我就不必在更改Rails应用程序后清除浏览器缓存了吗?
nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65; …Run Code Online (Sandbox Code Playgroud) 我是nodejs的新手,并尝试从nodemailer模块发送邮件,但它有错误,即" Unsupported configuration, downgrade Nodemailer to v0.7.1 to use it".
这是我的代码: -
var nodemailer = require('nodemailer');
var mailTransport = nodemailer.createTransport('SMTP', {
service: 'Gmail',
auth: {
user: 'xxxxxxxx@gmail.com',
pass: 'xxxxxxxxx',
}
});
mailTransport.sendMail({
from: '"ABC" <info@xxxx.example.com>',
to: 'abcsss@xxx.example.com',
subject: 'Test',
text: 'Thank you for contact.',
}, function (err) {
if (err)
console.error('Unable to send email: ' + err);
});
Run Code Online (Sandbox Code Playgroud) 如果该ls命令列出了目录的内容,那么某些输出ls <directory似乎表明目录存在.
例如,这就是我得到的:
> ls ~/.ssh
id_rsa id_rsa.pub known_hosts
Run Code Online (Sandbox Code Playgroud)
但是为什么那么,当我输入时cd ~/.ssh,我会得到
> cd ~/.ssh
The system cannot find the path specified.
Run Code Online (Sandbox Code Playgroud)
?
为什么我可以列出此目录的内容但不导航到它?
我使用的是Windows 8
有时我必须向camel注册表添加一个对象(当然还有java).在大多数情况下,它是一个dataSource.
我的问题是我无法弄清楚一般的工作方式.
我总是开始获得注册表:
getContext().getRegistry();
Run Code Online (Sandbox Code Playgroud)
但"注册表"没有任何添加对象的方法.所以我必须尝试(使用调试器)正在使用哪种注册表
getContext().getRegistry(some.class)<some method to add something>;
Run Code Online (Sandbox Code Playgroud)
例如,在一个项目(骆驼蓝图)中,我必须打电话
SimpleRegistry registry = new SimpleRegistry();
registry.put("some", bean);
getContext().getRegistry(CompositeRegistry.class).addRegistry(registry);
Run Code Online (Sandbox Code Playgroud)
现在我创建了一个具有相同结构的项目(也是相同的maven父项),但现在上面的代码停止工作,因为由于某种原因现在camel使用了PropertyPlaceholderDelegateRegistry我确信会有代码来添加我的bean但是;
是否有适用于每个设置的代码可以为camels注册表添加内容?
我有一个数字海洋 Ubuntu 服务器,两天前我网站上的每个页面都给我错误 500,
在 ssh 中,我收到此错误消息“设备上没有剩余空间”,
有关更多信息,请查看此 SSH 屏幕截图,
以便我恢复备份并且服务器和网站现在可以正常工作,但在不久的将来会再次发生
这是当前的服务器状态
root@****:~# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
udev 4077544 4 4077540 1% /dev
tmpfs 817680 340 817340 1% /run
/dev/vda1 82436784 34630128 43596088 45% /
none 4 0 4 0% /sys/fs/cgroup
none 5120 0 5120 0% /run/lock
none 4088392 0 4088392 0% /run/shm
none 102400 0 102400 0% /run/user
root@****:~# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 1019386 402 1018984 1% /dev …Run Code Online (Sandbox Code Playgroud) apache-camel ×1
bash ×1
caching ×1
cd ×1
chef-infra ×1
cloud ×1
cmd ×1
email ×1
express ×1
flask ×1
javascript ×1
jquery ×1
ls ×1
nginx ×1
node.js ×1
nodemailer ×1
partitioning ×1
php ×1
symfony ×1
twig ×1
ubuntu ×1