Настройка CI и VPS сервер / Хабр

Gitlab ce cloud hosting, gitlab ce installer, docker container and vm


Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.

GitLab CE packaged by Bitnami provides a one-click install solution for GitLab CE. Download virtual machines or run your own gitlab ce server in the cloud.

GitLab CE is an open source, cloud-based Git repository and version control system used by thousands of organizations worldwide. Written in Ruby, GitLab CE includes a host of features that enable software development teams to consolidate source code, track and manage releases, increase code quality, deploy code changes, and track the evolution of software over time.

Also included in the GitLab CE stack is a fully functional Continuous Integration and Delivery (CI/CD) system that can build, test, and deploy software updates as your team produces new code. Supporting the CI/CD functionality of GitLab is a private registry for Docker containers, enabling teams to streamline updates for production deployments that are running on a microservices architecture.

Настройка репозитория

Открываем settings -> CI

Затем у пункта Runners нажимаем expand
image

Первым делом выключаем предложенные runners — Disable shared runners

Затем, нас интересует — «Set up a specific Runner manually»

Копируем токен, в будущем он нам понадобится.

Подготовка vps

Устанавливаем

Устанавливаем gitlab-runner.

Регистрируем новый runner.

! В поле executor указываем docker версии, как и в Dockerfile!В поле token указываем токен, который запомнили из gitlab

gitlab-runner register

image

Теперь, нужно внести небольшие правки в конфиг runner’а.

nano /etc/gitlab-runner/config.toml

поле

volumes = ["/cache"]

меняем на

volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]

image

Выполняем рестарт демона

gitlab-runner restart


Снова возвращаемся к gitlab/settings/CI/Runners.

Читайте также:  Откройте для себя преимущества TeamViewer: повысить производительность стало проще

Должен появиться активный runner

Редактируем runner, нажатием

Разрешаем выполнять задачи без тэгов

Теперь выполняем push коммита и следим за job’ами

И напоследок открываем браузер

Ссылка на репозиторий

P.S.: Я встретил проблему — у меня собранный образ изнутри не имел доступа к внешней сети, решение — создать файл/etc/docker/daemon.json:

{
    "dns": ["8.8.4.4", "8.8.8.8"]
}
 service docker restart

Предпосылки


На работе, ув. DevOps’ы настроили мне деплой проектов в

kubernetesработаю я Go-разработчиком

). У меня есть свой пет-проект — и мне захотелось автоматизации, но поднимать у себя gitlab желания особого не было (VPS не резиновый все таки).

Создание репозитория

Создаем репозиторий, который хотим автоматизировать.

Я решил для тестов, поднять docker с nginx и пробросом на html страницу.

Структура репозитория:

Оцените статью
Хостинги