This week I worked on syslog integration in skynet and delve into details of skynet. I also started using Gitlab CI.
skynet
- 云风的 BLOG: 代理服务和过载保护。使用 debug 命令 PING 可以检查服务是否还在,目前平均响应时间怎么样。命令 LINK 可以用来监控服务是否退出。
弄了一套脚本来编译,安装 skynet,生成和管理 skynet 项目。大概用起来
# 创建项目 helloworld sx new helloworld # 启动 skynet 应用 cd helloworld sx skynet boot/helloworld.lua # 创建新的 skynet 应用 sx new-app server sx skynet boot/server.lua # 执行 Lua sx lua
Gitlab CI
Gitlab documentation does not mention how to setup docker registry key. Indeed, it requires a pair of RSA keys, use private key in Gitlab and public key in docker registry.
In
.gitlab-ci.yml
, variables defined in job level is also effective in top fields, such asbefore_script
andservices
. Here is an example to test Rails using MySQL and Postgresimage: rails services: - redis - $DB cache: key: bundle paths: - vendor/bundle variables: POSTGRES_DB: center_test POSTGRES_USER: runner POSTGRES_PASSWORD: "" MYSQL_DATABASE: center_test MYSQL_ROOT_PASSWORD: root before_script: - cp config/database.ci-$DB.yml config/database.yml - cp .ci.env .env - bundle install --jobs $(nproc) --path=vendor/bundle .test: &test_template script: - bundle exec rake db:create RAILS_ENV=test - RAILS_ENV=test bundle exec rake db:reset - bundle exec rake test test_pg: <<: *test_template variables: DB: postgres test_mysql: <<: *test_template variables: DB: mysql
Using Docker Build - GitLab Documentation. I use dind to build docker images in Gitlab CI. It requires starting docker in privilege mode, which breaks some containers such as mysql. A simple solution is registering 2 docker runners, one is in privilege and another is not. Tag runners and add tags in
.gitlab-ci.yml
to filter runner.In Mac,
gitlab-ci-multi-runner
must be started in user desktop environment. The runner may stuck at checkout code because the GUI is asking for keychain access. Just approve the access in desktop environment.
DevOps
- GitHub - 3pjgames/terraform-provider-dnspod: Terraform Provider Plugin which manages DNS records in dnspod.cn
- ubuntu - How can I selectively override some A records on a Bind DNS Server? - Server Fault. I need to override some A record to speed up internal SVN and Git access in Office. I used to setup zone file for the whole domain. However if I need to update DNS records, I have to update office zone config files and update in DNS provider. This solution saves my time, thanks a lot.
- 服务发现:Zookeeper vs etcd vs Consul - DockOne.io. Etcd does only one thing, Consule is more feature rich.
- Backing up your minions’ databases to the Salt master. Let minion push files to master.
Misc
- 最近转到 Bear 作为主力笔记应用
- GitHub - tj/git-extras: GIT utilities — repo summary, repl, changelog population, author commit percentages and more. Bundle of useful git commands.
- GitHub - tpope/vim-eunuch: eunuch.vim: helpers for UNIX. I love
Rename
. - Bugsnag Blog - Benefits of using tmux - lessons from streamlining a development environment