编辑:我想注意,如果我在计算机上使用 cloud sdk 手动部署,则不会发生此问题。只有管道
再次编辑:我在我的 gcloud 应用程序部署中添加了一个 verbosity=debug。这是生成的内容:
Do you want to continue (Y/n)?
DEBUG: No bucket specified, retrieving default bucket.
DEBUG: Using bucket [gs://staging.PROJECT.appspot.com].
DEBUG: Service [appengineflex.googleapis.com] is already enabled for project [PROJECT]
Beginning deployment of service [default]...
INFO: Need Dockerfile to be generated for runtime php
Building and pushing image for service [default]
DEBUG: 'ascii' codec can't decode byte 0xe2 in position 26: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 845, in Execute …Run Code Online (Sandbox Code Playgroud) 我在docker容器中通过Gulp运行browsersync时遇到问题。我正在使用Laradock。
我试图从以下答案推断:Docker容器内的Browsersync,但我只能使UI显示在端口3001上。
我不清楚我应该为代理做什么。我尝试了许多组合,例如:
function browserSync(done) {
browsersync.init({
proxy: 'workspace:22', notify:false, open:false
});
done();
}
// -----------------
function browserSync(done) {
browsersync.init({
proxy: 'workspace:3000', notify:false, open:false
});
done();
}
// ---------------
function browserSync(done) {
browsersync.init({
proxy: 'localhost', notify:false, open:false
});
done();
}
Run Code Online (Sandbox Code Playgroud)
我在工作区服务下的docker-compose.yml中添加了3000和3001
### Workspace Utilities ##################################
workspace:
build:
context: ./workspace
args:
- LARADOCK_PHP_VERSION=${PHP_VERSION}
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
- INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION}
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
- INSTALL_PHPDBG=${WORKSPACE_INSTALL_PHPDBG}
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
- INSTALL_SSH2=${WORKSPACE_INSTALL_SSH2}
- INSTALL_GMP=${WORKSPACE_INSTALL_GMP}
- INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
- INSTALL_XSL=${WORKSPACE_INSTALL_XSL}
- INSTALL_LDAP=${WORKSPACE_INSTALL_LDAP}
- INSTALL_IMAP=${WORKSPACE_INSTALL_IMAP}
- INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
- INSTALL_AMQP=${WORKSPACE_INSTALL_AMQP} …Run Code Online (Sandbox Code Playgroud) 我在别人制作的网站上工作。有一个生产版本。
我正在尝试向属性在 30 天内未更新的用户发送电子邮件。
一切正常,直到我尝试使用deliver_later. 我使用的原因deliver_later是deliver_now导致每秒发送过多电子邮件的问题。我目前正在使用 Mailtrap 进行测试,但我认为我会在生产中遇到那种问题。
所以我选择为每封电子邮件等待 1 秒:
@testproperties = Property.has_not_updated.includes(:user)
@testproperties.each do |property|
UserMailer.with(property: property, user: property.user).check_listing.deliver_later(wait:1.seconds)
end
Run Code Online (Sandbox Code Playgroud)
这导致 IO::EINPROGRESSWaitWritable Operation now in progress - connect(2) would block
没有任何东西发送。
我不知道如何解决这个问题。
编辑:我可以在生产站点上看到我可以访问路由/sidekiq。路由文件有这个块:
authenticate :user, lambda { |u| u.admin? } do
mount Sidekiq::Web => '/sidekiq'
end
Run Code Online (Sandbox Code Playgroud)
我可以查看 Web 界面并查看所有作业。这一切都在那里工作。但我需要访问在localhost:3000.
尝试在本地访问它仍然会导致:
Operation now in progress - connect(2) would block
# # Socket#connect
def connect_nonblock(addr, exception: true)
__connect_nonblock(addr, exception)
end
end
Run Code Online (Sandbox Code Playgroud)
Sidekiq.rb: …
对于我的某些表,我想插入固定数量的包含特定数据的行。
这是我的类别工厂:
$factory->define(Category::class, function (Faker $faker) {
return [
[
'name' => 'Politics',
'slug' => 'politics',
'description' => 'To discuss politics'
],
[
'name' => 'News and Events',
'slug' => 'news',
'description' => 'To discuss news and world events'
],
[
'name' => 'Food and Cooking',
'slug' => 'cooking',
'description' => 'To discuss cooking and food'
],
[
'name' => "Animals and Nature",
'slug' => 'animals-nature',
'description' => 'To discuss politics'
]
];
});
Run Code Online (Sandbox Code Playgroud)
这是播种机:
public function run() {
factory(App\Category::class, …Run Code Online (Sandbox Code Playgroud) 更深入地研究这一点,我不确定这是否可能,这很遗憾,因为我正在尝试学习 TDD。
我想通过Billable创建和订阅计划来测试我的模型。
/** @test */
public function an_account_can_subscribe_to_a_plan() {
$account = factory("App\Account")->create();
Stripe::setApiKey('key');
$paymentMethod = PaymentMethod::create([
'type' => 'card',
'card' => [
'number' => '4242424242424242',
'exp_month' => '2',
'exp_year' => '2021',
'cvc' => '314'
]
]);
$subscription = $account->newSubscription('default', 'starter')->create($paymentMethod);
$this->assertTrue( $subscription->valid() );
}
Run Code Online (Sandbox Code Playgroud)
Laravel Cashier 文档展示了如何通过 Stripe.js 发送令牌,但这不适用于单元测试。
我尝试直接包含 Stripe 库并创建一个PaymentMethod对象,但这也需要我手动设置 API 密钥。现在我收到的错误是我必须验证我的电话号码才能将原始信用卡号发送到 stripe API。
我希望有更好的方法。如何以 TDD 方式使用 Laravel Cashier 并使用虚假付款方式模拟虚假订阅?
我的容器突然崩溃了,现在无法启动:
这是启动和错误/关闭的日志:
Starting dev-laradock_mysql_1 ... done
Attaching to dev-laradock_mysql_1
mysql_1 | 2021-04-19T14:40:37.622458Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
mysql_1 | 2021-04-19T14:40:37.622522Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 1
mysql_1 | 2021-04-19T14:40:37.624025Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias …Run Code Online (Sandbox Code Playgroud) 我已添加服务器的 SSH 密钥以在 github 中部署密钥。
运行后mina deploy我得到以下信息:
-----> Quiet sidekiq (stop accepting new work)
/var/www/myproject/tmp/build-157262358827785
-----> Fetching new git commits
Run Code Online (Sandbox Code Playgroud)
它留在这里,什么也没有发生
当我按 ctrl + c 时,它会说
-----> Mina: SIGINT received.
Enter passphrase for key '/root/.ssh/id_rsa':
Elapsed time: 1931.59 seconds
Run Code Online (Sandbox Code Playgroud)
在我的deploy.rb文件中set :term_mode, nil,人们说你需要它,因为当输入 SSH 密码后挂起时,但我从来没有准备好,直到我在控制台中执行 ctrl + c 。
没有办法输入密码
编辑:
我-v为详细输出做了一个标志:
-----> Quiet sidekiq (stop accepting new work)
$ cd /var/www/myproject/current
$ if [ -f /var/www/myproject/shared/pids/sidekiq.pid ] && kill -0 `cat /var/www/myproject/shared/pids/sidekiq.pid` …Run Code Online (Sandbox Code Playgroud) 我有一个简单的联系表单,接受以下字段(全部为必填字段):姓名、电子邮件、电话和消息。
我还想验证电子邮件地址。
应向用户提供有关表单提交是否成功或是否有错误的响应。
如果是这样,则在视图上显示特定错误。
该表单未连接到任何数据库模型。我不会保存提交的内容。只能邮寄。
contact_form我在 PagesController 中设置了 POST 路由
在我的 PagesController 中我有
def contact_form
UserMailer.contact_form(contact_form_params).deliver
end
Run Code Online (Sandbox Code Playgroud)
在我的 UserMailer 类中,我有:
def contact_form(params)
@formParams = params;
@date = Time.now
mail(
to: "support@example.com",
subject: 'New Contact Form Submission',
from: @formParams[:email],
reply_to: @formParams[:email],
)
end
Run Code Online (Sandbox Code Playgroud)
邮件已成功发送,但没有验证。如果验证通过,我只需要运行邮件块。然后向用户返回响应。
由于我没有模型,我不知道该怎么做。validates我看到的所有答案都告诉人们在 ActiveRecord 模型上使用。
有了几个答案:
(注意我已经更新了我的参数)
class UserMailerForm
include ActiveModel::Validations
def initialize(options)
options.each_pair{|k,v|
self.send(:"#{k}=", v) if respond_to?(:"#{k}=")
}
end
attr_accessor :first_name, :last_name, :email, :phone, :message
validates :first_name, :last_name, :email, :phone, :message, presence: true
validates :email, …Run Code Online (Sandbox Code Playgroud) docker ×2
laravel ×2
ruby ×2
actionmailer ×1
bitbucket ×1
browser-sync ×1
gcloud ×1
innodb ×1
laradock ×1
laravel-5 ×1
mina-deploy ×1
mysql ×1
php ×1
seeding ×1
ssh ×1