• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Jaranguda

Belajar Mengajar

  • Home
  • Sponsor/Jasa
  • Tentang

GitLab

Gitlab Pages sebagai Website Pribadi

Last Updated on 30 November 2017 By tommy 2 Comments

Login ke gitlab.com, buat repo baru sesuai dengan username.gitlab.io, contoh jaranguda.gitlab.io. Sekarang buat folder baru di komputer anda (disini saya menggunakan Linux).

Buat folder untuk file-file website

mkdir jaranguda

lalu buat file untuk website anda, contoh filenya bisa di download disini
pindahkan semua file yang di download ke folder jaranguda
struktur file yang di download diatas

├── css
│   ├── bootstrap.min.css
│   └── navbar-fixed-top.css
├── .gitlab-ci.yml
└── index.html

sekarang kita upload ke gitlab.

inisialisasi sebagai git

cd jaranguda
git init
git remote add origin git@gitlab.com:USERNAME/USERNAME.gitlab.io.git
git add .
git commit -m 'pertama kali'
git push -u origin master

ganti USERNAME dengan username anda.

Setelah beberapa saat, file yang di push muncul di gitlab
jaranguda on gitlab

Contoh hasil jadinya, bisa dilihat di http://jaranguda.gitlab.io/

Penjelasan

Bila anda menjalankan langkah-langkah diatas, pasti berhasil ;). Untuk build gitlab pages, intinya ada di file .gitlab-ci.yml

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r * .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master

untuk meng-hosting file statik, konfigurasi diatas sudah lebih dari cukup. Kalo mau kaya github yang pake branch gh-pages di ganti - master diatas menjadi - gh-pages lalu buat branch baru dengan nama gh-pages di git lokal anda.

Dengan cara diatas kita bisa menghosting Pelican, Jekyll, Hugo dan berbagai static file generator lainnya di Gitlab Pages. Tetapi kalo mau adu kecepatan sama Github pages, Gitlab pages masih kalah jauh karena gitlab ngga pake CDN sedangkan Github pake Fastly

Filed Under: Linux Tagged With: GitLab

Menggunakan SSL di GitLab CE

Last Updated on 15 June 2015 By tommy Leave a Comment

Disini saya menggunakan Omnibus untuk menginstall GitLab CE (Community Edition). File konfigurasi nginx disimpan di /var/opt/gitlab/nginx
Buat folder baru tempat menyimpan file SSL

mkdir /var/opt/gitlab/nginx/ssl

Self Signed SSL

Pindah ke folder ssl lalu generate SSL dengan perintah

openssl req -sha256 -nodes -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 3560

Commercial SSL/SSL Berbayar

Bila menggunakan SSL berbayar, certificate dan key tinggal di copy paste ke file cert.pem dan key.pem.

Cara untuk menggunakan SSL berbayar maupun Self signed sama saja ;). Edit server block nginx /var/opt/gitlab/nginx/conf/gitlab-http.conf
tambahkan di baris paling bawah

server {
  ssl on;
  listen *:443;
  server_name git.fgg;
  ssl_certificate /var/opt/gitlab/nginx/ssl/cert.pem;
  ssl_certificate_key /var/opt/gitlab/nginx/ssl/key.pem;
  server_tokens off; ## Don't show the nginx version number, a security best practice
  root /opt/gitlab/embedded/service/gitlab-rails/public;
 
  ## Increase this if you want to upload large attachments
  ## Or if you want to accept large git objects over http
  client_max_body_size 250m;
 
 
  ## Individual nginx logs for this GitLab vhost
  access_log  /var/log/gitlab/nginx/gitlab_access.log;
  error_log   /var/log/gitlab/nginx/gitlab_error.log;
 
  location / {
    ## Serve static files from defined root folder.
    ## @gitlab is a named location for the upstream fallback, see below.
    try_files $uri $uri/index.html $uri.html @gitlab;
  }
 
  location /uploads/ {
    ## If you use HTTPS make sure you disable gzip compression
    ## to be safe against BREACH attack.
    gzip off;
 
    ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## Some requests take more than 30 seconds.
    proxy_read_timeout      300;
    proxy_connect_timeout   300;
    proxy_redirect          off;
 
    proxy_set_header    Host                $http_host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;
    proxy_set_header    X-Frame-Options     SAMEORIGIN;
 
    proxy_pass http://gitlab;
  }
 
  ## If a file, which is not found in the root folder is requested,
  ## then the proxy passes the request to the upsteam (gitlab unicorn).
  location @gitlab {
    ## If you use HTTPS make sure you disable gzip compression
    ## to be safe against BREACH attack.
      ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## Some requests take more than 30 seconds.
    proxy_read_timeout      300;
    proxy_connect_timeout   300;
    proxy_redirect          off;
 
    proxy_set_header    Host                $http_host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;
    proxy_set_header    X-Frame-Options     SAMEORIGIN;
 
    proxy_pass http://gitlab;
  }
 
  ## Enable gzip compression as per rails guide:
  ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
  ## WARNING: If you are using relative urls remove the block below
  ## See config/application.rb under "Relative url support" for the list of
  ## other files that need to be changed for relative url support
  location ~ ^/(assets)/ {
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
  }
  error_page 502 /502.html;
 
}

yang perlu di edit adalah bagian server_name dan letak file SSL anda.

Terakhir restart semua service gitlab

gitlab-ctl restart

Filed Under: Linux Tagged With: git, GitLab

Primary Sidebar

Pencarian

Tanya Jawab tentang DevOps SRE CPE, gabung di https://t.me/devopsindonesia

Terbaru

  • Cara Mengganti Port Screen Sharing macOS
  • Cara Menonaktifkan Pager di macOS
  • Cara Mengupdate Nama Apple silicon-as-a-Service Scaleway
  • Cara Force Delete Namespace di Kubernetes
  • Install PHP MariaDB di Mac Monterey

Komentar

  • mazda on Tutorial Lengkap Install Mail Server Postfix Dovecot MariaDB di CentOS 7
  • adi on Menggunakan Mikrotik Sebagai SSH Client
  • aris u on Solusi Simple Queue Mikrotik Tidak Berjalan
  • Bowo on Cara Mematikan SSID Molecool Balifiber
  • aris on Solusi Simple Queue Mikrotik Tidak Berjalan

Tulisan Populer

  • Password Router Huawei HG8245H5 Indihome 1.2m views
  • Password Terbaru ZTE F609 Indihome 784.5k views
  • Password Superadmin Huawei HG8245A 318.7k views
  • Cara Setting Manual Modem GPON ZTE F609 Indihome 273.1k views
  • Cara Setting Wireless ZTE F609 Indihome 257.2k views
  • Mengaktifkan Port LAN di Huawei HG8245 Indihome 169.9k views
  • Akses UseeTV Indihome via Wireless ZTE F609 156.8k views
  • Kemana Menghilangnya Saldo BCA 50 ribu 153.4k views
  • Cara Reset Password ZTE F609 Indihome 147.6k views
  • Cara Setting DHCP Server Modem/Router ZTE F609 113.6k views

Kategori

  • Delphi
  • dll
  • Gambas
  • Internet
  • Java
  • Lazarus
  • Linux
  • PHP
  • Review
  • Teknologi

Sponsor

kadal.id
carakami.com
kuotabisa.com
Untuk jadi sponsor, hubungi kita lewat halaman sponsor
© 2021. Jaranguda
  • Linux
  • PHP
  • Internet
  • Teknologi
  • Delphi
  • Gambas
  • Java