Fixes plugins
This commit is contained in:
23
wiki/Prog/Git/Git автоматическое сохранение в репозиторий.md
Normal file
23
wiki/Prog/Git/Git автоматическое сохранение в репозиторий.md
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Git: автоматическое сохранение в репозиторий"
|
||||
category: Программирование
|
||||
tags: программирование, git
|
||||
summary: ""
|
||||
...
|
||||
|
||||
Скрипт [gitwatch](https://github.com/elnull/gitwatch) позволяет отслеживать
|
||||
изменения в каталоге с помощью программы `inotifywait` и фиксировать их в
|
||||
репозиторий. Для работы скрипта необходимо установить пакет `inotify-tools`.
|
||||
Если нужно следить за каталогом `/home/user/dir` и записывать историю
|
||||
изменений в `/home/user/repo/dir`, то нужно инициализировать репозиторий:
|
||||
|
||||
git init --bare /home/user/repo/dir
|
||||
|
||||
добавить шаблоны исключаемых файлов
|
||||
|
||||
printf '*.[oa]\n*.swp\n*~\n/.git' >> /home/user/repo/dir/info/exclude
|
||||
|
||||
и запустить скрипт
|
||||
|
||||
./gitwatch.sh -g /home/user/repo/dir /home/user/dir
|
||||
|
27
wiki/Prog/Git/Git репозиторий на переносном устройстве.md
Normal file
27
wiki/Prog/Git/Git репозиторий на переносном устройстве.md
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
title: "Git: репозиторий на переносном устройстве"
|
||||
category: Программирование
|
||||
tags: программирование, git
|
||||
summary:
|
||||
...
|
||||
|
||||
Создание репозитория для нового проекта
|
||||
|
||||
```sh
|
||||
ln -s /media/user/usbdisk/git /home/user/work/usbdisk/git
|
||||
git --bare init /home/user/work/usbdisk/git/project.git
|
||||
cd /home/user/work/projects
|
||||
git clone /home/user/work/usbdisk/git/project.git
|
||||
cd project
|
||||
git remote set-url origin file:///home/user/work/usbdisk/git/project.git/
|
||||
```
|
||||
|
||||
Добавление нового удалённого репозитория к существующему проекту
|
||||
|
||||
```sh
|
||||
ln -s /media/user/usbdisk/git /home/user/work/usbdisk/git
|
||||
git --bare init /home/user/work/usbdisk/git/project.git
|
||||
cd /home/user/work/projects/project
|
||||
git remote add usb file:///home/user/work/usbdisk/git/project.git
|
||||
git push --set-upstream usb master
|
||||
```
|
29
wiki/Prog/Git/Git частичная копия репозитория.md
Normal file
29
wiki/Prog/Git/Git частичная копия репозитория.md
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
title: "Git: частичная копия репозитория"
|
||||
category: Программирование
|
||||
tags: программирование, git
|
||||
summary: ""
|
||||
...
|
||||
|
||||
Частичную копию репозитория можно создавать, если проект
|
||||
очень большой, а следить нужно только за малой его частью.
|
||||
Допустим, по адресу `git://localhost/project.git` находится
|
||||
большой проект, в котором интересует только последнее
|
||||
состояние каталогов `src/driver` и `include/driver`.
|
||||
Сначала нужно создать репозиторий и подготовить его для
|
||||
получения только необходимых файлов:
|
||||
|
||||
```sh
|
||||
git init project
|
||||
cd project
|
||||
git remote add origin git://localhost/project.git
|
||||
git config core.sparsecheckout true
|
||||
echo "src/driver/*" >> .git/info/sparse-checkout
|
||||
echo "include/driver/*" >> .git/info/sparse-checkout
|
||||
```
|
||||
|
||||
После этого можно получать частичную копию проекта,
|
||||
а, добавив ключ `--depth=1`, указать, что синхронизироваться
|
||||
должно только текущее состояние файлов без учёта истории.
|
||||
|
||||
git pull --depth=1 origin master
|
147
wiki/Prog/Git/Установка и настройка GitLab в LXC.md
Normal file
147
wiki/Prog/Git/Установка и настройка GitLab в LXC.md
Normal file
@ -0,0 +1,147 @@
|
||||
---
|
||||
title: "Установка и настройка GitLab в LXC"
|
||||
category: Программирование
|
||||
tags: программирование, gitlab, git, lxc, контейнеры, ubuntu
|
||||
summary:
|
||||
toc: yes
|
||||
...
|
||||
|
||||
[TOC]
|
||||
|
||||
Установка вылолняется в операционной системе Ubuntu Bionic.
|
||||
|
||||
### LXC
|
||||
|
||||
Создание базового контейнера:
|
||||
|
||||
```sh
|
||||
lxc-create -t download -n bionic-base -- --dist ubuntu --release bionic --arch amd64
|
||||
```
|
||||
|
||||
Создание контейнеров для GitLab и GitLab Runner:
|
||||
|
||||
```sh
|
||||
lxc-copy -n bionic-base -N gitlab-bionic -s
|
||||
lxc-copy -n bionic-base -N gitlab-runner-bionic -s
|
||||
```
|
||||
|
||||
Файл `/var/lib/lxc/gitlab-bionic/config`:
|
||||
|
||||
```
|
||||
# Distribution configuration
|
||||
lxc.include = /usr/share/lxc/config/common.conf
|
||||
|
||||
lxc.arch = linux64
|
||||
lxc.start.auto = 1
|
||||
|
||||
# Network configuration
|
||||
lxc.net.0.type = veth
|
||||
lxc.net.0.link = br0
|
||||
lxc.net.0.flags = up
|
||||
lxc.net.0.ipv4.address = 192.168.0.216/24
|
||||
lxc.net.0.ipv4.gateway = 192.168.0.1
|
||||
lxc.net.0.hwaddr = 00:16:3e:00:02:16
|
||||
|
||||
# Container specific configuration
|
||||
lxc.rootfs.path = overlay:/var/lib/lxc/bionic-base/rootfs:/var/lib/lxc/gitlab-bionic/delta0
|
||||
lxc.uts.name = gitlab-bionic
|
||||
|
||||
lxc.autodev = 1
|
||||
lxc.pty.max = 16384
|
||||
lxc.cgroup.devices.allow = c 10:200 rwm
|
||||
lxc.mount.entry = /dev/net dev/net none bind,create=dir
|
||||
```
|
||||
|
||||
Файл `/var/lib/lxc/gitlab-runner-bionic/config`:
|
||||
|
||||
```
|
||||
# Distribution configuration
|
||||
lxc.include = /usr/share/lxc/config/common.conf
|
||||
|
||||
lxc.arch = linux64
|
||||
lxc.start.auto = 1
|
||||
|
||||
# Network configuration
|
||||
lxc.net.0.type = veth
|
||||
lxc.net.0.link = br0
|
||||
lxc.net.0.flags = up
|
||||
lxc.net.0.ipv4.address = 192.168.0.217/24
|
||||
lxc.net.0.ipv4.gateway = 192.168.0.1
|
||||
lxc.net.0.hwaddr = 00:16:3e:00:02:17
|
||||
|
||||
# Container specific configuration
|
||||
lxc.rootfs.path = overlay:/var/lib/lxc/bionic-base/rootfs:/var/lib/lxc/gitlab-runner-bionic/delta0
|
||||
lxc.uts.name = gitlab-runner-bionic
|
||||
|
||||
# Required for Docker
|
||||
lxc.aa_profile = unconfined
|
||||
lxc.cgroup.devices.allow = a
|
||||
lxc.cap.drop =
|
||||
|
||||
lxc.autodev = 1
|
||||
lxc.pty.max = 16384
|
||||
lxc.cgroup.devices.allow = c 10:200 rwm
|
||||
lxc.mount.entry = /dev/net dev/net none bind,create=dir
|
||||
```
|
||||
|
||||
### GitLab
|
||||
|
||||
Установить GitLab:
|
||||
|
||||
```sh
|
||||
sudo lxc-start -n gitlab-bionic
|
||||
sudo lxc-attach -n gitlab-bionic
|
||||
sudo apt install curl
|
||||
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
|
||||
sudo apt install gitlab-ce
|
||||
```
|
||||
|
||||
Отредактировать файл `/etc/locale.gen` и сгенерировать локали для системы:
|
||||
|
||||
```sh
|
||||
sudo locale-gen
|
||||
```
|
||||
|
||||
Отредактировать файл `/etc/gitlab/gitlab.rb` и выполнить:
|
||||
|
||||
```sh
|
||||
sudo gitlab-ctl reconfigure
|
||||
sudo gitlab-ctl restart
|
||||
```
|
||||
|
||||
|
||||
### GitLab Runner и Docker
|
||||
|
||||
Установить GitLab Runner:
|
||||
|
||||
```sh
|
||||
sudo lxc-start -n runner-bionic
|
||||
sudo lxc-attach -n runner-bionic
|
||||
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
|
||||
sudo apt install gitlab-runner docker.io
|
||||
sudo gitlab-runner register
|
||||
```
|
||||
|
||||
Во время установки ввести токен приведённый на странице `admin/runners`,
|
||||
а в качестве исполнителя задач `docker`.
|
||||
|
||||
Для работы Docker внутри контейнера нужно удалить AppArmor:
|
||||
|
||||
```sh
|
||||
sudo apt purge apparmor
|
||||
```
|
||||
|
||||
Внутри контейнера для Docker желательно использовать драйвер `btrfs`
|
||||
cat /etc/docker/daemon.json
|
||||
|
||||
{
|
||||
"storage-driver": "btrfs"
|
||||
}
|
||||
|
||||
|
||||
|
||||
### Ссылки
|
||||
|
||||
* [GitLab Runner](https://docs.gitlab.com/runner/register/index.html)
|
||||
* [Runners](https://docs.gitlab.com/ee/ci/runners/)
|
||||
* [Gitlab-CI](https://habr.com/ru/company/southbridge/blog/306596/)
|
Reference in New Issue
Block a user