2021年03月
2021-03-01 周一
Docker in Docker 配置内网通信
GitLab Runner 执行结束时会以网络的形式向主服务发送生成的产物(artifacts),原先我配置的都是用公网访问的,但是既然 Runner 都在内网中就可以直接内网通信,指定 Docker bridge 后用容器名即可访问
Runner 配置中的 URL 地址由 https://gitlab.tabll.cn/ 更换成了 http://GitLab/
此时注册和运行都是没有问题的,只是使用了 docker 执行器的 runner 会有问题,卡在 Uploading artifacts 这一步上:

Uploading artifacts as "dependency_scanning" to coordinator... error error=couldn't execute POST against
这是由于 Runner 开启的新的 Docker 没有网络桥接导致的
可以看到只要指定 network_mode 就可以了:
privileged = true
network_mode = "gitLab_runner_bridge"
volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock", "/tmp/builds:/builds"]
然后可正常运行
2021-03-02 周二
解决 Confluence 使用 HTTPS 访问提示未配置反向代理
由于使用的是内网穿透,所以有些服务代理出来确实有点问题
在使用 https 访问的时候一直会有以下提示,关闭后刷新页面也会一直提示错误,换成 http 访问就不会有问题,但是 https 肯定不能不要

文档上说该检查插件可以禁用,但是在管理员后台发现目前新版本系统提供的插件无法禁用了
解决方法是在 Docker 的文档中:https://hub.docker.com/r/atlassian/confluence-server
按照参数配置以下三个反向代理的参数即可:
ATL_TOMCAT_SCHEME https
ATL_PROXY_NAME doc.tabll.cn
ATL_PROXY_PORT 443
2021-03-03 周三
地图
地图切片服务器
https://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}
子区域地图选择器
https://datav.aliyun.com/tools/atlas
2021-03-04 周四
2021-03-05 周五
2021-03-08 周一
2021-03-09 周二
2021-03-10 周三
Laravel 保存关联关系
使用 push 可以同时更新关联关系
class User extends Model
{
public function phone()
{
return $this->hasOne('App\Phone');
}
}
$user = User::first();
$user->name = "Peter";
$user->phone->number = '1234567890';
$user->save(); // 只更新 User Model
$user->push(); // 更新 User 和 Phone Model
这个 push 的源代码实现:
/**
* Save the model and all of its relationships.
*
* @return bool
*/
public function push()
{
if ( ! $this->save()) return false;
// To sync all of the relationships to the database, we will simply spin through
// the relationships and save each model via this "push" method, which allows
// us to recurse into all of these nested relations for the model instance.
foreach ($this->relations as $models)
{
foreach (Collection::make($models) as $model)
{
if ( ! $model->push()) return false;
}
}
return true;
}
2021-03-11 周四
Confluence 插件推荐
Confluence Server 版本现在已经停止新授权的售卖了,之后的更新将不会包括新的功能
2021-03-12 周五
来自微博用户,腾讯安全大佬 tombkeeper:
今天有人说不知为何最近网络不太正常。这就是年轻人不知节气,不懂时令。每年惊蛰、芒种前后网络都会不太好,需要提前做准备。惊蛰是万物复苏的时候,海里的蛤蟆虾米咸带鱼也开始活动,所以会影响到海底光缆。而芒种又要收麦子又要种晚稻,一收一种,上行流量和下行流量同时激增,必然影响网络访问。
2021-03-15 周一
Excel 日期数据导入
导入 Excel 中的日期数据时,无法正常取到数据,取出的值是一串数字
这时候需要使用 excelToDateTimeObject 转换一下
Carbon::parse(Date::excelToDateTimeObject($value))->format('Y-m-d')
也可以这样
$n = intval(($temp_str - 25569) * 3600 * 24);
$time = gmdate('Y-m-d', $n);