SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
Deploy
En Gitlab
vía FTP
G. Mizael Mtz Hdz
SOFTWARE ENGINEER
“
Automatizar el envío de código fuente
desde un repositorio en Gitlab hacia tu
Servidor (producción), por medio de
FTP
.
PASO #1: Push a
master/main
git push -u origin master / main
merge request
PASO #2: Despliegue del código
desde Gitlab hacia nuestro
servidor (cPanel/ HestiaCP/
Plesk) a través de FTP
Ambiente de desarrollo.
GitFlow
AGENDA
INTRODUCCIÓN
Aprender los conceptos
generales sobre los
despliegues automáticos
CONFIGURACIÓN EN GITLAB
Configurar el repositorio
de Gitlab + FTP
RESULTADO
Mostrar el resultado de la
configuración del
repositorio
INTRODUCCIÓN
Aprender los conceptos generales sobre
los despliegues automáticos
01.
PASO #1: Push a
master/main
git push -u origin master / main
merge request
PASO #2: Despliegue del código
desde Gitlab hacia nuestro
servidor (cPanel/ HestiaCP/
Plesk) a través de FTP
Ambiente de desarrollo.
GitFlow
INTRODUCCIÓN
CI
Integración continua,
nuevas características
(automatizado).
CD
Despliegue continuo
(automatizado)
AUTOMATIZACIÓN
● Ser ágil
● Entregar software de calidad
Fuente: redhat
INTRODUCCIÓN
.gitlab-ci.yml
Archivo donde se definen
los JOB's CI/CD
CONTENEDOR
Capacidad de ejecutar varios procesos y
aplicaciones por separado para hacer un mejor uso
de su infraestructura y, al mismo tiempo, conservar
la seguridad que tendría con sistemas separados
LFTP
transferencia de archivos desde
la consola de comandos.
INTRODUCCIÓN
PIPELINE
Conjunto de scripts (Jobs)
que se definen en
.gitlab-ci.yml
JOB
Funcionalidades únicas.
RUNNERS
Proceso encargado de ejecutar las
instrucciones definidas en archivos
.gitlab-ci.yml
CONFIGURACIÓN EN GITLAB
Configurar el repositorio de Gitlab + FTP
02.
PASO #1: Push a
master/main
git push -u origin master / main
merge request
PASO #2: Despliegue del código
desde Gitlab hacia nuestro
servidor (cPanel/ HestiaCP/
Plesk) a través de FTP
Ambiente de desarrollo.
GitFlow
CONFIGURACIÓN EN GITLAB
PRECONFIGURACIÓN
Antes de iniciar con la configuración es importante conocer la siguiente información del proyecto /
repositorio:
1. La rama que desencadenará el despliegue (regularmente master o main).
2. Si el servidor destino, soporta conexiones por FTP / SFTP (SSH) / ETC.
3. Que carpetas o archivos solo necesitan subirse una vez, para descartarlos en el archivo de
configuración “.gitlab-ci.yml”, como por ej.
a. system/
b. vendor/
c. config/
d. .git/
e. .gitignore
f. .gitlab-ci.yml
g. etc.
4. Tener un repositorio en Gitlab
a. Rol “Maintainer“ o “Owner”
CONFIGURACIÓN EN GITLAB
CREACIÓN DE CUENTA FTP
● HestiaCP
○ Login en el Web Panel
○ Web > *Seleccionar dominio/subdominio > Additional FTP account(s)
■ FTP #1
● Username: admin_gitlab
● Password: wq3HownaqQ2Ly1um
● Path: /home/admin/web/witsoftplus.com/public_html/gitlab_ftp
● Servidor: http://witsoftplus.com/
● Url: http://witsoftplus.com/gitlab_ftp
cPanel: cuenta de FTP
cPanel: cuenta de FTP
CONFIGURACIÓN EN GITLAB
CONFIGURAR VARIABLES
● En el repositorio que estamos configurando > clic en el menú de la izquierda > Settings > CI / CD
● En la sección de “Variables” expandir y dar de alta las siguientes 3 variables:
○ FTP_SERVER: ftp.witsoftplus.com
○ FTP_USERNAME: admin_gitlab
○ FTP_PASSWORD: wq3HownaqQ2Ly1um
CONFIGURACIÓN EN GITLAB
CREACIÓN DE ARCHIVO “.gitlab-ci.yml” EN GITLAB
● Iniciar sesión en Gitlab: https://gitlab.com/
● Agregar un archivo llamado “.gitlab-ci.yml” en el directorio root del repositorio.
○ https://gitlab.com/g.-mizael-mtz-hdz/gitflow-en-gitlab
● Notas:
○ No necesariamente se tiene que utilizar la imagen de docker: ubuntu:18.04.
○ No agregar la etiqueta -e o --delete: ya que si no existen los archivos del repositorio en el
servidor, se eliminarán.
○ Es recomendable excluir aquellas carpetas que solo se necesitan subir una vez, como por
ej. system/ (core de codeigniter), vendor/ (a menos que se actualicen los paquetes que se
están utilizando), etc.
● Ejemplos de archivo .gitlab-ci.yml
○ https://gist.github.com/gmizaelmtzhdz/a66376dbac8e5e73363f40f2413591ac
○ https://gist.github.com/gmizaelmtzhdz/b89cc754e7a27daf806350adfdfe7cd3
○ https://gist.github.com/gmizaelmtzhdz/4abafafce454719db3e653d1bdfdfc3a
○ https://gist.github.com/gmizaelmtzhdz/1ea7eaf788335d325dd5c22c22b53160
RESULTADO
Mostrar el resultado de la configuración
del repositorio
03.
PROBANDO EL
DEPLOY
Analizar el despliegue
Cuota de uso
Job
HACIENDO CAMBIOS
EN EL “.gitlab-ci.yml”
Gitlab
Siguiente paso...
Gitlab
¡Gracias!
¿Tienes alguna duda?
G. Mizael Mtz Hdz
SOFTWARE ENGINEER

Mais conteúdo relacionado

Mais procurados

All about Zookeeper and ClickHouse Keeper.pdf
All about Zookeeper and ClickHouse Keeper.pdfAll about Zookeeper and ClickHouse Keeper.pdf
All about Zookeeper and ClickHouse Keeper.pdfAltinity Ltd
 
Lean Inception: how to align people and build the right product
Lean Inception: how to align people and build the right productLean Inception: how to align people and build the right product
Lean Inception: how to align people and build the right productPaulo Caroli
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitMaulik Shah
 
Case Study: Migration to GitLab (from Bitbucket) at AppsFlyer
Case Study: Migration to GitLab (from Bitbucket) at AppsFlyerCase Study: Migration to GitLab (from Bitbucket) at AppsFlyer
Case Study: Migration to GitLab (from Bitbucket) at AppsFlyerNoa Harel
 
A painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaA painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaBo-Yi Wu
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use ItDaniel Kummer
 
Creating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouseCreating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouseAltinity Ltd
 
Useful PostgreSQL Extensions
Useful PostgreSQL ExtensionsUseful PostgreSQL Extensions
Useful PostgreSQL ExtensionsEDB
 
Hardware Assisted Latency Investigations
Hardware Assisted Latency InvestigationsHardware Assisted Latency Investigations
Hardware Assisted Latency InvestigationsScyllaDB
 
Presto as a Service - Tips for operation and monitoring
Presto as a Service - Tips for operation and monitoringPresto as a Service - Tips for operation and monitoring
Presto as a Service - Tips for operation and monitoringTaro L. Saito
 
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...DoKC
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用Will Huang
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHubNishan Bose
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git BasicsSreedath N S
 

Mais procurados (20)

Serenity and the Journey Pattern
Serenity and the Journey PatternSerenity and the Journey Pattern
Serenity and the Journey Pattern
 
All about Zookeeper and ClickHouse Keeper.pdf
All about Zookeeper and ClickHouse Keeper.pdfAll about Zookeeper and ClickHouse Keeper.pdf
All about Zookeeper and ClickHouse Keeper.pdf
 
Lean Inception: how to align people and build the right product
Lean Inception: how to align people and build the right productLean Inception: how to align people and build the right product
Lean Inception: how to align people and build the right product
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
 
Case Study: Migration to GitLab (from Bitbucket) at AppsFlyer
Case Study: Migration to GitLab (from Bitbucket) at AppsFlyerCase Study: Migration to GitLab (from Bitbucket) at AppsFlyer
Case Study: Migration to GitLab (from Bitbucket) at AppsFlyer
 
A painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaA painless self-hosted Git service: Gitea
A painless self-hosted Git service: Gitea
 
Git
GitGit
Git
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Creating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouseCreating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouse
 
Useful PostgreSQL Extensions
Useful PostgreSQL ExtensionsUseful PostgreSQL Extensions
Useful PostgreSQL Extensions
 
Hardware Assisted Latency Investigations
Hardware Assisted Latency InvestigationsHardware Assisted Latency Investigations
Hardware Assisted Latency Investigations
 
Presto as a Service - Tips for operation and monitoring
Presto as a Service - Tips for operation and monitoringPresto as a Service - Tips for operation and monitoring
Presto as a Service - Tips for operation and monitoring
 
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
Running PostgreSQL in Kubernetes: from day 0 to day 2 with CloudNativePG - Do...
 
ClickHouse Keeper
ClickHouse KeeperClickHouse Keeper
ClickHouse Keeper
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Introduction to GitHub
Introduction to GitHubIntroduction to GitHub
Introduction to GitHub
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git Basics
 

Semelhante a Deploy gitlab vía ftp

GuiaPrincipiantesGitHubrfuenzalidadev.pptx
GuiaPrincipiantesGitHubrfuenzalidadev.pptxGuiaPrincipiantesGitHubrfuenzalidadev.pptx
GuiaPrincipiantesGitHubrfuenzalidadev.pptxfuenzalidarodrigo
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a GitManuel Ceron
 
Curso: Publicando mi proyecto web en Github
Curso: Publicando mi proyecto web en GithubCurso: Publicando mi proyecto web en Github
Curso: Publicando mi proyecto web en GithubCarlos Huamaní
 
Git para-principiantes
Git para-principiantesGit para-principiantes
Git para-principiantesnscoder_mad
 
Git: un enfoque práctico
Git: un enfoque prácticoGit: un enfoque práctico
Git: un enfoque prácticoPatxi Gortázar
 
Git & GitHub Part II
Git & GitHub Part IIGit & GitHub Part II
Git & GitHub Part IIMax Rodriguez
 
Control de versiones utilizando Git
Control de versiones utilizando GitControl de versiones utilizando Git
Control de versiones utilizando GitHugo Gilmar Erazo
 
Presentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora Blanco
Presentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora BlancoPresentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora Blanco
Presentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora BlancoAntonio Luque Bravo
 
Todo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDAD
Todo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDADTodo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDAD
Todo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDADDIEGOALBERTOENRIQUEZ4
 
Uso practico de git
Uso practico de gitUso practico de git
Uso practico de gitKeopx
 
Más allá de Git add/commit/push
Más allá de Git add/commit/pushMás allá de Git add/commit/push
Más allá de Git add/commit/pushAlexis Lopez
 

Semelhante a Deploy gitlab vía ftp (20)

Git flow en github
Git flow en githubGit flow en github
Git flow en github
 
Git flow en gitlab
Git flow en gitlabGit flow en gitlab
Git flow en gitlab
 
Flujos de trabajo y mejores prácticas en git
Flujos de trabajo y mejores prácticas en gitFlujos de trabajo y mejores prácticas en git
Flujos de trabajo y mejores prácticas en git
 
GuiaPrincipiantesGitHubrfuenzalidadev.pptx
GuiaPrincipiantesGitHubrfuenzalidadev.pptxGuiaPrincipiantesGitHubrfuenzalidadev.pptx
GuiaPrincipiantesGitHubrfuenzalidadev.pptx
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a Git
 
Curso: Publicando mi proyecto web en Github
Curso: Publicando mi proyecto web en GithubCurso: Publicando mi proyecto web en Github
Curso: Publicando mi proyecto web en Github
 
Introducción a Git
Introducción a GitIntroducción a Git
Introducción a Git
 
Git para-principiantes
Git para-principiantesGit para-principiantes
Git para-principiantes
 
Git: un enfoque práctico
Git: un enfoque prácticoGit: un enfoque práctico
Git: un enfoque práctico
 
Git & GitHub Part II
Git & GitHub Part IIGit & GitHub Part II
Git & GitHub Part II
 
Control de versiones utilizando Git
Control de versiones utilizando GitControl de versiones utilizando Git
Control de versiones utilizando Git
 
Fundamentos de GIt y Github
Fundamentos de GIt y GithubFundamentos de GIt y Github
Fundamentos de GIt y Github
 
Git y github básico
Git y github básicoGit y github básico
Git y github básico
 
Presentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora Blanco
Presentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora BlancoPresentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora Blanco
Presentación GitHub Antonio Luque Bravo y Miguel Ángel Zamora Blanco
 
Git.manual.usuario
Git.manual.usuarioGit.manual.usuario
Git.manual.usuario
 
Todo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDAD
Todo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDADTodo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDAD
Todo sobre el mundo del GIT-INTEGRACION-CONCEPTOS-USABILIDAD
 
wp-cli
wp-cliwp-cli
wp-cli
 
Git training
Git trainingGit training
Git training
 
Uso practico de git
Uso practico de gitUso practico de git
Uso practico de git
 
Más allá de Git add/commit/push
Más allá de Git add/commit/pushMás allá de Git add/commit/push
Más allá de Git add/commit/push
 

Deploy gitlab vía ftp

  • 1. Deploy En Gitlab vía FTP G. Mizael Mtz Hdz SOFTWARE ENGINEER
  • 2. “ Automatizar el envío de código fuente desde un repositorio en Gitlab hacia tu Servidor (producción), por medio de FTP .
  • 3. PASO #1: Push a master/main git push -u origin master / main merge request PASO #2: Despliegue del código desde Gitlab hacia nuestro servidor (cPanel/ HestiaCP/ Plesk) a través de FTP Ambiente de desarrollo. GitFlow
  • 4. AGENDA INTRODUCCIÓN Aprender los conceptos generales sobre los despliegues automáticos CONFIGURACIÓN EN GITLAB Configurar el repositorio de Gitlab + FTP RESULTADO Mostrar el resultado de la configuración del repositorio
  • 5. INTRODUCCIÓN Aprender los conceptos generales sobre los despliegues automáticos 01.
  • 6. PASO #1: Push a master/main git push -u origin master / main merge request PASO #2: Despliegue del código desde Gitlab hacia nuestro servidor (cPanel/ HestiaCP/ Plesk) a través de FTP Ambiente de desarrollo. GitFlow
  • 7. INTRODUCCIÓN CI Integración continua, nuevas características (automatizado). CD Despliegue continuo (automatizado) AUTOMATIZACIÓN ● Ser ágil ● Entregar software de calidad Fuente: redhat
  • 8. INTRODUCCIÓN .gitlab-ci.yml Archivo donde se definen los JOB's CI/CD CONTENEDOR Capacidad de ejecutar varios procesos y aplicaciones por separado para hacer un mejor uso de su infraestructura y, al mismo tiempo, conservar la seguridad que tendría con sistemas separados LFTP transferencia de archivos desde la consola de comandos.
  • 9. INTRODUCCIÓN PIPELINE Conjunto de scripts (Jobs) que se definen en .gitlab-ci.yml JOB Funcionalidades únicas. RUNNERS Proceso encargado de ejecutar las instrucciones definidas en archivos .gitlab-ci.yml
  • 10. CONFIGURACIÓN EN GITLAB Configurar el repositorio de Gitlab + FTP 02.
  • 11. PASO #1: Push a master/main git push -u origin master / main merge request PASO #2: Despliegue del código desde Gitlab hacia nuestro servidor (cPanel/ HestiaCP/ Plesk) a través de FTP Ambiente de desarrollo. GitFlow
  • 12. CONFIGURACIÓN EN GITLAB PRECONFIGURACIÓN Antes de iniciar con la configuración es importante conocer la siguiente información del proyecto / repositorio: 1. La rama que desencadenará el despliegue (regularmente master o main). 2. Si el servidor destino, soporta conexiones por FTP / SFTP (SSH) / ETC. 3. Que carpetas o archivos solo necesitan subirse una vez, para descartarlos en el archivo de configuración “.gitlab-ci.yml”, como por ej. a. system/ b. vendor/ c. config/ d. .git/ e. .gitignore f. .gitlab-ci.yml g. etc. 4. Tener un repositorio en Gitlab a. Rol “Maintainer“ o “Owner”
  • 13. CONFIGURACIÓN EN GITLAB CREACIÓN DE CUENTA FTP ● HestiaCP ○ Login en el Web Panel ○ Web > *Seleccionar dominio/subdominio > Additional FTP account(s) ■ FTP #1 ● Username: admin_gitlab ● Password: wq3HownaqQ2Ly1um ● Path: /home/admin/web/witsoftplus.com/public_html/gitlab_ftp ● Servidor: http://witsoftplus.com/ ● Url: http://witsoftplus.com/gitlab_ftp
  • 16. CONFIGURACIÓN EN GITLAB CONFIGURAR VARIABLES ● En el repositorio que estamos configurando > clic en el menú de la izquierda > Settings > CI / CD ● En la sección de “Variables” expandir y dar de alta las siguientes 3 variables: ○ FTP_SERVER: ftp.witsoftplus.com ○ FTP_USERNAME: admin_gitlab ○ FTP_PASSWORD: wq3HownaqQ2Ly1um
  • 17. CONFIGURACIÓN EN GITLAB CREACIÓN DE ARCHIVO “.gitlab-ci.yml” EN GITLAB ● Iniciar sesión en Gitlab: https://gitlab.com/ ● Agregar un archivo llamado “.gitlab-ci.yml” en el directorio root del repositorio. ○ https://gitlab.com/g.-mizael-mtz-hdz/gitflow-en-gitlab ● Notas: ○ No necesariamente se tiene que utilizar la imagen de docker: ubuntu:18.04. ○ No agregar la etiqueta -e o --delete: ya que si no existen los archivos del repositorio en el servidor, se eliminarán. ○ Es recomendable excluir aquellas carpetas que solo se necesitan subir una vez, como por ej. system/ (core de codeigniter), vendor/ (a menos que se actualicen los paquetes que se están utilizando), etc. ● Ejemplos de archivo .gitlab-ci.yml ○ https://gist.github.com/gmizaelmtzhdz/a66376dbac8e5e73363f40f2413591ac ○ https://gist.github.com/gmizaelmtzhdz/b89cc754e7a27daf806350adfdfe7cd3 ○ https://gist.github.com/gmizaelmtzhdz/4abafafce454719db3e653d1bdfdfc3a ○ https://gist.github.com/gmizaelmtzhdz/1ea7eaf788335d325dd5c22c22b53160
  • 18. RESULTADO Mostrar el resultado de la configuración del repositorio 03.
  • 19. PROBANDO EL DEPLOY Analizar el despliegue Cuota de uso Job
  • 20. HACIENDO CAMBIOS EN EL “.gitlab-ci.yml” Gitlab
  • 22. ¡Gracias! ¿Tienes alguna duda? G. Mizael Mtz Hdz SOFTWARE ENGINEER