Skip to content

Instantly share code, notes, and snippets.

@jodykpw
jodykpw / .tmp
Created April 16, 2019 06:21
test
################################################################################
## GitLab Nginx
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html
################################################################################
nginx['listen_port'] = 80
nginx['listen_https'] = false
nginx['proxy_set_headers'] = {
"X-Forwarded-Proto" => "https",
"X-Forwarded-Ssl" => "on"
}
@jodykpw
jodykpw / .html
Created April 16, 2019 06:24
Site Maintenance
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@jodykpw
jodykpw / .yml
Created April 16, 2019 06:31
gitlab-runner docker-compose example
version: '3'
services:
gitlab-runner:
container_name: gitlab-runner-hostname
restart: always
image: gitlab/gitlab-runner:alpine-v11.7.0
environment:
TZ: "Asia/Hong_Kong"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@jodykpw
jodykpw / .gitlab-ci.yml
Last active April 16, 2019 09:38
Simple CI/CD (Executor SSH) .gitlab-ci.yml
# PRODUCTION
.prd_ci_job: &prd_ci_job
only:
- production
tags:
- hostname-shared-ssh
.prd_ci_manual_job: &prd_ci_manual_job
when: manual
<<: *prd_ci_job
@jodykpw
jodykpw / docker-run.txt
Last active April 16, 2019 09:35
Use Docker socket binding
gitlab-runner register -n \
--url https://example.com \
--registration-token your-token \
--executor docker \
--description "hostname-shared-docker" \
--tag-list "hostname-shared-docker" \
--docker-image "docker:stable" \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock
@jodykpw
jodykpw / docker-run.text
Last active May 24, 2020 19:33
GitLab CI/CD (Executor Docker) Runner
gitlab-runner register -n \
--url https://gitlab.domain.com/ \
--registration-token your-registration-token \
--executor docker \
--description "hostname-shared-docker" \
--tag-list "hostname-shared-docker" \
--docker-image "docker:stable" \
--docker-privileged true \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock
@jodykpw
jodykpw / gitlab-ci
Created April 18, 2019 03:11
Building Docker images with GitLab CI/CD
image: docker:stable
variables:
CONTAINER_IMAGE: container-registry.domain/$CI_PROJECT_PATH
stages:
- build
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
@jodykpw
jodykpw / Dockerfile
Created April 18, 2019 03:22
Building Docker images with GitLab CI/CD
FROM busybox:latest
MAINTAINER Jody Wan ([email protected])
CMD ["date"]
@jodykpw
jodykpw / .gitlab-ci.yml
Last active April 29, 2019 08:20
Shared SSH GitLab Runner Example
# PRODUCTION
.prd_ci_job: &prd_ci_job
only:
- production
tags:
- hostname.shared.ssh
.prd_ci_manual_job: &prd_ci_manual_job
when: manual
<<: *prd_ci_job
@jodykpw
jodykpw / docker-compose.yml
Created May 20, 2019 05:21
GitLab OpenLDAP config
### LDAP Settings
###! Docs: https://docs.gitlab.com/omnibus/settings/ldap.html
###! **Be careful not to break the indentation in the ldap_servers block. It is
###! in yaml format and the spaces must be retained. Using tabs will not work.**
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = {
'main' => {
'label' => 'LDAP',
'host' => 'nerv-system.live',