push gitea-rc4
This commit is contained in:
parent
145ee4a365
commit
85ab951830
26
gitea-rc4/docker-compose.override.yml
Normal file
26
gitea-rc4/docker-compose.override.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
my_service:
|
||||||
|
environment:
|
||||||
|
- USER_UID=${GITEA_UID}
|
||||||
|
- USER_GID=${GITEA_GID}
|
||||||
|
- GITEA__database__DB_TYPE=${RDBMS}
|
||||||
|
- GITEA__database__HOST=my_db:${RDBMS_PORT}
|
||||||
|
- GITEA__database__NAME=${DB_NAME}
|
||||||
|
- GITEA__database__USER=${DB_USER}
|
||||||
|
- GITEA__database__PASSWD=${DB_PASSWD}
|
||||||
|
volumes:
|
||||||
|
- ${GITEA_VOL_HOST}:${GITEA_VOL_CONTAINER}
|
||||||
|
- ${GIT_SSH_VOL_HOST}:${GITEA_SSH_PATH_CONTAINER}
|
||||||
|
|
||||||
|
ports:
|
||||||
|
# - "${GITEA_SSH_EXPOSE}:${GITEA_SSH_CONTAINER}"
|
||||||
|
- "${GITEA_IP_SSH_EXPOSE}:${GITEA_SSH_CONTAINER}"
|
||||||
|
|
||||||
|
my_db:
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=${DB_USER}
|
||||||
|
- POSTGRES_PASSWORD=${DB_PASSWD}
|
||||||
|
- POSTGRES_DB=${DB_NAME}
|
||||||
|
volumes:
|
||||||
|
- ${POSTGRES_VOL_PATH_HOST}:${POSTGRES_PATH_CONTAINER}
|
||||||
28
gitea-rc4/docker-compose.yml
Normal file
28
gitea-rc4/docker-compose.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
## version: '3.9'
|
||||||
|
|
||||||
|
networks:
|
||||||
|
my_net:
|
||||||
|
external: false
|
||||||
|
|
||||||
|
services:
|
||||||
|
my_service:
|
||||||
|
image: ${GITEA_IMAGE}
|
||||||
|
container_name: ${CONTAINER_NAME}
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- my_net
|
||||||
|
volumes:
|
||||||
|
- ${TIMEZONE_FILE}:${TIMEZONE_FILE_CONTAINER}
|
||||||
|
- ${LOCALTIME_FILE}:${LOCALTIME_FILE_CONTAINER}
|
||||||
|
ports:
|
||||||
|
- "${GITEA_HTTP_EXPOSE}:${GITEA_HTTP_CONTAINER}"
|
||||||
|
depends_on:
|
||||||
|
- my_db
|
||||||
|
|
||||||
|
my_db:
|
||||||
|
image: ${RDBMS_IMAGE}
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- my_net
|
||||||
132
gitea-rc4/gitea-rc4.md
Normal file
132
gitea-rc4/gitea-rc4.md
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
# Estructura inicial del proyecto
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gitea-rc4 $ tree -a
|
||||||
|
.
|
||||||
|
├── docker-compose.override.yml
|
||||||
|
├── docker-compose.yml
|
||||||
|
└── .env
|
||||||
|
```
|
||||||
|
|
||||||
|
_Nota autor:_ algunos datos en este documento pueden estar ofuscados.
|
||||||
|
|
||||||
|
## Configuración y ejecución de los contenedores Docker
|
||||||
|
|
||||||
|
### Configuración autenticación ssh - Docker Shell (with authorized_keys)
|
||||||
|
|
||||||
|
_Referencia principal:_ [Installation with Docker](https://docs.gitea.com/installation/install-with-docker#docker-shell-with-authorized_keys) - Docker Shell (with authorized_keys).
|
||||||
|
|
||||||
|
### Configuración de la aplicación y usario de Gitea
|
||||||
|
|
||||||
|
En el host motor de Docker se realizan las siguientes tareas de configuración. Estas son:
|
||||||
|
|
||||||
|
```
|
||||||
|
source .env
|
||||||
|
export CONTAINER_NAME GITEA_ACCOUNT GITEA_UID GITEA_GID
|
||||||
|
sudo groupadd -g ${GITEA_UID} ${GITEA_ACCOUNT}
|
||||||
|
sudo useradd -u ${GITEA_UID} -g ${GITEA_GID} -G docker -d /home/${GITEA_ACCOUNT} ${GITEA_ACCOUNT}
|
||||||
|
#sudo usermod -G docker -a ${GITEA_ACCOUNT}
|
||||||
|
sudo -u ${GITEA_ACCOUNT} ssh-keygen -t rsa -b 4096 -C "Gitea Host Key"
|
||||||
|
|
||||||
|
sudo -u ${GITEA_ACCOUNT} cat /home/${GITEA_ACCOUNT}/.ssh/id_rsa.pub | sudo -u ${GITEA_ACCOUNT} tee -a /home/${GITEA_ACCOUNT}/.ssh/authorized_keys
|
||||||
|
sudo -u ${GITEA_ACCOUNT} chmod 600 /home/${GITEA_ACCOUNT}/.ssh/authorized_keys
|
||||||
|
|
||||||
|
cat <<EOF | sudo tee /home/${GITEA_ACCOUNT}/docker-shell
|
||||||
|
#!/bin/sh
|
||||||
|
/usr/bin/docker exec -i -u ${GITEA_ACCOUNT} --env SSH_ORIGINAL_COMMAND="\$SSH_ORIGINAL_COMMAND" ${CONTAINER_NAME} sh "\$@"
|
||||||
|
EOF
|
||||||
|
sudo chmod +x /home/${GITEA_ACCOUNT}/docker-shell
|
||||||
|
sudo usermod -s /home/${GITEA_ACCOUNT}/docker-shell ${GITEA_ACCOUNT}
|
||||||
|
|
||||||
|
# id ${GITEA_ACCOUNT} # <-- el usuario git sobre el host anfitrion debe poder ejecutar docker para esta configuración funcione (es el usuario que redirecciona la conexión ssh al propio contenedor de Gitea).
|
||||||
|
##$ id ${GITEA_ACCOUNT}
|
||||||
|
## uid=...(git) gid=...(git) groups=...(git),...(docker)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Revisar/ajustar estructura
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -pv data/{gitea,postgres}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Estructura (sugerida) antes de ejcutar los contenedores
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gitea-rc4]$ tree -a
|
||||||
|
.
|
||||||
|
├── data # Carpeta para los volúmenes persistentes
|
||||||
|
│ ├── gitea
|
||||||
|
│ └── postgres
|
||||||
|
├── docker-compose.override.yml
|
||||||
|
├── docker-compose.yml
|
||||||
|
├── .env
|
||||||
|
└── gitea-rc4.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Iniciar los contenedores
|
||||||
|
|
||||||
|
```
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
## Instalar Gitea
|
||||||
|
|
||||||
|
Acceder a: `http://localhost:<$GITEA_HTTP_PORT_EXTERNAL>` e instalar Gitea
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Registrar usuario y copiar credenciales
|
||||||
|
|
||||||
|
En esta sección se registra un usuario y se copia su clave pública.
|
||||||
|
|
||||||
|
### Registrar usuario
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Usuario logado - setting
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
#### Setting - copiar clave pública
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Utilización de Gitea
|
||||||
|
|
||||||
|
En las siguientes capturas se muestran ejemplo como copiar/clonar dos repositorios que el usuario `userdevel1`. Uno mediante el URL sobre `http` y el otro mediante `ssh`.
|
||||||
|
|
||||||
|
- `git clone http://almalinux9-docker:3000/usrdevel1/repositorio1.git`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- `git clone git@almalinux9-docker:usrdevel1/repo-2.git`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Otros comandos
|
||||||
|
|
||||||
|
- Ver los logs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose logs -f
|
||||||
|
```
|
||||||
|
|
||||||
|
## Resumen: explicación de la configuración
|
||||||
|
|
||||||
|
- .env
|
||||||
|
|
||||||
|
- Centraliza las credenciales y configuraciones sensibles.
|
||||||
|
|
||||||
|
- `docker-compose.yml`
|
||||||
|
|
||||||
|
- Define los servicios principales, como Postgres y Gitea (Nginx), con configuraciones básicas, en contenedores separados.
|
||||||
|
|
||||||
|
- `docker-compose.override.yml`
|
||||||
|
|
||||||
|
- Extiende o reemplaza configuraciones para propósitos específicos, como desarrollo o debug.
|
||||||
|
|
||||||
|
- Volúmenes
|
||||||
|
|
||||||
|
- La base de datos de Postgres en ubica en `...data/postgres`.
|
||||||
|
- El servicio o aplicación Gitea se persiste en `...data/gitea`.
|
||||||
|
- También se utilizan otros volumenes, como el de las credenciales.
|
||||||
BIN
gitea-rc4/images/git-gitea-clone-w-http.png
Normal file
BIN
gitea-rc4/images/git-gitea-clone-w-http.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
BIN
gitea-rc4/images/git-gitea-clone-w-ssh.png
Normal file
BIN
gitea-rc4/images/git-gitea-clone-w-ssh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 153 KiB |
BIN
gitea-rc4/images/gitea-account-settings.png
Normal file
BIN
gitea-rc4/images/gitea-account-settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
BIN
gitea-rc4/images/gitea-add-key.png
Normal file
BIN
gitea-rc4/images/gitea-add-key.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
BIN
gitea-rc4/images/gitea-install.png
Normal file
BIN
gitea-rc4/images/gitea-install.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
BIN
gitea-rc4/images/gitea-register-account.png
Normal file
BIN
gitea-rc4/images/gitea-register-account.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
Loading…
Reference in New Issue
Block a user