| @ -1 +0,0 @@ | |||||
| Subproject commit f1482b4579a16540fd63cdccda7d9887f7061e7e | |||||
| @ -0,0 +1,4 @@ | |||||
| kubectl create -f pv-local-mysql-gitea.yaml | |||||
| kubectl create -f pv-local-gitea.yaml | |||||
| kubectl create -k ./ | |||||
| #watch kubectl get all -n gitea | |||||
| @ -0,0 +1,62 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: gitea | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 3000 | |||||
| nodePort: 30780 | |||||
| targetPort: gitea | |||||
| selector: | |||||
| app: gitea | |||||
| tier: frontend | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: gitea | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: gitea | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| containers: | |||||
| - name: gitea | |||||
| image: gitea/gitea:latest | |||||
| ports: | |||||
| - containerPort: 3000 | |||||
| name: gitea | |||||
| - containerPort: 22 | |||||
| name: git-ssh | |||||
| volumeMounts: | |||||
| - mountPath: /data | |||||
| name: git-volume | |||||
| volumes: | |||||
| - name: git-volume | |||||
| persistentVolumeClaim: | |||||
| claimName: gitea-pv-claim | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: gitea-pv-claim | |||||
| namespace: gitea | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 2Gi | |||||
| @ -0,0 +1,4 @@ | |||||
| apiVersion: v1 | |||||
| kind: Namespace | |||||
| metadata: | |||||
| name: gitea | |||||
| @ -0,0 +1,13 @@ | |||||
| secretGenerator: | |||||
| - name: mysqlgitea-pass | |||||
| namespace: gitea | |||||
| literals: | |||||
| - password=Dsa-0213 | |||||
| - db_user=root | |||||
| - db_passwd=Dsa-0213 | |||||
| resources: | |||||
| - gitea-namespace.yaml | |||||
| - registry-secrets.yaml | |||||
| - mysql-deployment-gitea.yaml | |||||
| - gitea-deployment.yaml | |||||
| - php-myadmin-gitea-deployment.yaml | |||||
| @ -0,0 +1,73 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: gitea-mysql | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: mysql | |||||
| port: 3306 | |||||
| nodePort: 30782 | |||||
| targetPort: mysql | |||||
| selector: | |||||
| app: gitea | |||||
| tier: mysql | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: mysql-gitea-pv-claim | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 20Gi | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: gitea-mysql | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: gitea | |||||
| tier: mysql | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: gitea | |||||
| tier: mysql | |||||
| spec: | |||||
| containers: | |||||
| - image: mariadb:latest | |||||
| name: mysql | |||||
| env: | |||||
| - name: MYSQL_ROOT_PASSWORD | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlgitea-pass | |||||
| key: password | |||||
| ports: | |||||
| - containerPort: 3306 | |||||
| name: mysql | |||||
| volumeMounts: | |||||
| - name: mysql-persistent-storage | |||||
| mountPath: /var/lib/mysql | |||||
| imagePullSecrets: | |||||
| - name: reg-cred-secret | |||||
| volumes: | |||||
| - name: mysql-persistent-storage | |||||
| persistentVolumeClaim: | |||||
| claimName: mysql-gitea-pv-claim | |||||
| @ -0,0 +1,3 @@ | |||||
| kubectl delete -k ./ | |||||
| kubectl delete -f pv-local-mysql-gitea.yaml | |||||
| kubectl delete -f pv-local-gitea.yaml | |||||
| @ -0,0 +1,57 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: phpmyadmin-gitea | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| selector: | |||||
| app: gitea | |||||
| tier: phpmyadmin | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: phpadmin | |||||
| port: 80 | |||||
| nodePort: 30781 | |||||
| targetPort: phpmyadm | |||||
| --- | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: phpmyadmin-gitea | |||||
| namespace: gitea | |||||
| labels: | |||||
| app: gitea | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: gitea | |||||
| tier: phpmyadmin | |||||
| strategy: | |||||
| type: Recreate | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: gitea | |||||
| tier: phpmyadmin | |||||
| spec: | |||||
| containers: | |||||
| - name: phpmyadmin | |||||
| image: phpmyadmin | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| name: phpmyadm | |||||
| env: | |||||
| - name: PMA_HOST | |||||
| value: gitea-mysql | |||||
| - name: PMA_PORT | |||||
| value: "3306" | |||||
| - name: MYSQL_ROOT_PASSWORD | |||||
| valueFrom: | |||||
| secretKeyRef: | |||||
| name: mysqlgitea-pass | |||||
| key: password | |||||
| imagePullSecrets: | |||||
| - name: reg-cred-secret | |||||
| @ -1,11 +1,12 @@ | |||||
| apiVersion: v1 | apiVersion: v1 | ||||
| kind: PersistentVolume | kind: PersistentVolume | ||||
| metadata: | metadata: | ||||
| name: miweb-www-folder | |||||
| name: gitea-folder | |||||
| spec: | spec: | ||||
| capacity: | capacity: | ||||
| storage: 2Gi | storage: 2Gi | ||||
| accessModes: | accessModes: | ||||
| - ReadWriteMany | |||||
| - ReadWriteOnce | |||||
| hostPath: | hostPath: | ||||
| path: "/mnt/cluster/nginx" | |||||
| path: "/mnt/Externo/gitea/data" | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: gitea-data | |||||
| spec: | |||||
| capacity: | |||||
| storage: 20Gi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: "/mnt/Externo/gitea/gitea-db" | |||||
| @ -0,0 +1,11 @@ | |||||
| apiVersion: v1 | |||||
| data: | |||||
| .dockerconfigjson: eyJhdXRocyI6eyJkb2NrZXItcmVnaXN0cnk6MzIwMDAiOnsidXNlcm5hbWUiOiJjcmV5bG9wZXoiLCJwYXNzd29yZCI6IlJleS0xMTc2IiwiYXV0aCI6IlkzSmxlV3h2Y0dWNk9sSmxlUzB4TVRjMiJ9fX0= | |||||
| kind: Secret | |||||
| metadata: | |||||
| creationTimestamp: "2023-01-29T10:54:14Z" | |||||
| name: reg-cred-secret | |||||
| namespace: gitea | |||||
| resourceVersion: "19890385" | |||||
| uid: 66b3b7c5-26c1-4e5a-af4e-dc973aaafe4b | |||||
| type: kubernetes.io/dockerconfigjson | |||||
| @ -0,0 +1,3 @@ | |||||
| kubectl patch pv gitea-folder -p '{"metadata":{"finalizers":null}}' | |||||
| kubectl patch pv gitea-data -p '{"metadata":{"finalizers":null}}' | |||||
| @ -1,18 +0,0 @@ | |||||
| apiVersion: networking.k8s.io/v1 | |||||
| kind: Ingress | |||||
| metadata: | |||||
| name: cluster-ingress | |||||
| annotations: | |||||
| kubernetes.io/ingress.class: nginx | |||||
| spec: | |||||
| rules: | |||||
| - http: | |||||
| paths: | |||||
| - pathType: Prefix | |||||
| path: "/" | |||||
| backend: | |||||
| service: | |||||
| name: vaultwarden | |||||
| port: | |||||
| number: 80 | |||||
| @ -0,0 +1,20 @@ | |||||
| if [ "$1" = "i" ] | |||||
| then | |||||
| for i in calibre-chart firefly-chart gogs-chart mealiev1 mediawiki-chart navidrome-chart nextcloud-chart repostajes-chart vaultwarden-chart wordpress-chart | |||||
| do | |||||
| chart=`echo $i | cut -f1 -d-` | |||||
| helm install $chart ./$i --namespace=$chart --create-namespace | |||||
| done | |||||
| elif [ "$1" = "u" ] | |||||
| then | |||||
| for i in calibre-chart firefly-chart gogs-chart mealie-chart mealiev1 mediawiki-chart navidrome-chart nextcloud-chart repostajes-chart vaultwarden-chart wordpress-chart | |||||
| do | |||||
| chart=`echo $i | cut -f1 -d-` | |||||
| helm uninstall $chart -n $chart | |||||
| done | |||||
| else | |||||
| echo "Falta comando: i=instalar, u=desinstalar" | |||||
| fi | |||||
| @ -1,24 +0,0 @@ | |||||
| apiVersion: networking.k8s.io/v1 | |||||
| kind: Ingress | |||||
| metadata: | |||||
| name: mediawiki-ingress | |||||
| namespace: mediawiki | |||||
| annotations: | |||||
| kubernetes.io/ingress.class: nginx | |||||
| cert-manager.io/cluster-issuer: letsencrypt-production | |||||
| spec: | |||||
| tls: | |||||
| - hosts: | |||||
| - reymota.ddns.net | |||||
| secretName: letsencrypt-production | |||||
| rules: | |||||
| - host: "reymota.ddns.net" | |||||
| http: | |||||
| paths: | |||||
| - pathType: Prefix | |||||
| path: "/mediawiki" | |||||
| backend: | |||||
| service: | |||||
| name: mediawiki | |||||
| port: | |||||
| number: 80 | |||||
| @ -0,0 +1 @@ | |||||
| /library | |||||
| @ -0,0 +1,42 @@ | |||||
| FROM --platform=linux/amd64 ubuntu:latest | |||||
| RUN apt-get update && apt-get install -y curl xz-utils | |||||
| ARG CALIBRE_RELEASE="7.1.0" | |||||
| RUN curl -o /tmp/calibre-tarball.txz -L "https://download.calibre-ebook.com/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE}-x86_64.txz" && \ | |||||
| mkdir -p /opt/calibre && \ | |||||
| tar xvf /tmp/calibre-tarball.txz -C /opt/calibre && \ | |||||
| rm -rf /tmp/* | |||||
| FROM --platform=linux/amd64 debian:bookworm-slim | |||||
| RUN apt-get update && apt-get install -y \ | |||||
| dnsutils \ | |||||
| iproute2 \ | |||||
| libfontconfig \ | |||||
| libgl1 \ | |||||
| libegl1 \ | |||||
| libxkbcommon-x11-0 \ | |||||
| libopengl0 \ | |||||
| libnss3-dev \ | |||||
| libxcomposite-dev \ | |||||
| libxdamage1 \ | |||||
| libxrandr2 \ | |||||
| libxtst6 \ | |||||
| libxkbfile-dev \ | |||||
| xdg-utils \ | |||||
| && rm -rf /var/lib/apt/lists/* | |||||
| COPY --from=0 /opt/calibre /opt/calibre | |||||
| RUN mkdir /usr/share/desktop-directories/ | |||||
| RUN /opt/calibre/calibre_postinstall && \ | |||||
| mkdir /opt/calibre/calibre-library && \ | |||||
| touch /opt/calibre/calibre-library/metadata.db | |||||
| COPY server-users.sqlite /opt/calibre/calibre-library/server-users.sqlite | |||||
| COPY start-calibre-server.sh . | |||||
| EXPOSE 8080 | |||||
| CMD [ "/start-calibre-server.sh" ] | |||||
| @ -0,0 +1,57 @@ | |||||
| # [Docker Calibre Server](https://hub.docker.com/r/wietsedv/calibre-server) | |||||
|  | |||||
|  | |||||
|  | |||||
|  | |||||
|  | |||||
| Automatically updating Docker image for `calibre-server`. The image contains a minimal [Calibre](https://calibre-ebook.com/) installation and starts a Calibre server. The current version should correspond with the [latest Calibre release](https://github.com/kovidgoyal/calibre/releases). | |||||
| **Note:** This image is unofficial and not affiliated with Calibre. | |||||
| ## Usage | |||||
| Calibre server is a REST API + web interface for Calibre. For more information about usage of `calibre-server` itself, refer to the [user guide](https://manual.calibre-ebook.com/server.html) and the [CLI manual](https://manual.calibre-ebook.com/generated/en/calibre-server.html) of Calibre. | |||||
| ### Use case 1: Standalone container for local use | |||||
| ``` | |||||
| $ docker run -ti -p 8080:8080 wietsedv/calibre-server -v /path/to/library:/library | |||||
| ``` | |||||
| Now you have read+write access to your library via `localhost:8080`. | |||||
| ### Use case 2: Access from other containers within network | |||||
| The command of "Use case 1" gives r+w access to your library on the host machine, but other containers in the network have readonly access. Calibre does not allow giving global r+w access without whitelisting or authentication. To give write access to other containers you should use the Docker `host` network type (not recommended) or you can whitelist containers within the bridge network: | |||||
| ``` | |||||
| $ docker run -ti -p 8080:8080 -v /path/to/library:/library -e TRUSTED_HOSTS="web1 web2" wietsedv/calibre-server | |||||
| ``` | |||||
| **Note:** IP addresses of whitelisted containers (`web1` and `web2`) are resolved when `calibre-server` starts. So containers that need to access `calibre-server` have to start _before_ `calibre-server`. | |||||
| ### Use case 3: Docker compose (recommended) | |||||
| You can get the same setup as "Use case 2" with this `docker-compose.yaml`: | |||||
| ```yaml | |||||
| services: | |||||
| calibre: | |||||
| image: wietsedv/calibre-server | |||||
| volumes: | |||||
| - /path/to/library:/library | |||||
| ports: | |||||
| - "8080:8080" | |||||
| depends_on: # start web1 and web2 before calibre | |||||
| - web1 | |||||
| - web2 | |||||
| environment: | |||||
| TRUSTED_HOSTS: web1 web2 # whitelist web1 and web2 | |||||
| web1: | |||||
| image: nginx:alpine | |||||
| web2: | |||||
| image: nginx:alpine | |||||
| ``` | |||||
| @ -0,0 +1,10 @@ | |||||
| #!/bin/bash | |||||
| if [ -z "$1" ] | |||||
| then | |||||
| echo "Falta versión" | |||||
| else | |||||
| docker build --no-cache -t creylopez/calibre:$1 . | |||||
| docker push creylopez/calibre:$1 | |||||
| fi | |||||
| @ -0,0 +1,22 @@ | |||||
| #!/usr/bin/env bash | |||||
| # Resolve trusted IP addresses | |||||
| TRUSTED_IPS="$(ip route | awk '/default/ { print $3 }')" | |||||
| for h in $TRUSTED_HOSTS; do | |||||
| HOST_IP="$(nslookup -type=A $h | tail -n2 | awk '/Address:/ { print $2 }')" | |||||
| if [ -z "${HOST_IP}" ]; then | |||||
| >&2 echo "WARNING: host '$h' not found in network. container with that name will not get write access to the library" | |||||
| else | |||||
| TRUSTED_IPS="${TRUSTED_IPS},${HOST_IP}" | |||||
| fi | |||||
| done | |||||
| echo "trusted ips: ${TRUSTED_IPS}" | |||||
| touch "/opt/calibre/calibre-library/metadata.db" | |||||
| XDG_RUNTIME_DIR=/tmp/runtime-root /usr/bin/calibre-server \ | |||||
| --disable-use-bonjour \ | |||||
| --enable-local-write \ | |||||
| --userdb /opt/calibre/calibre-library/server-users.sqlite --enable-auth \ | |||||
| --trusted-ips="${TRUSTED_IPS}" \ | |||||
| "$@" \ | |||||
| "/opt/calibre/calibre-library" | |||||
| @ -0,0 +1,23 @@ | |||||
| #!/usr/bin/env bash | |||||
| set -e | |||||
| TAG="$(curl 'https://api.github.com/repos/kovidgoyal/calibre/releases?per_page=1' | jq -r '.[0].tag_name')" | |||||
| if [[ ! $TAG =~ ^v[0-9.]+$ ]]; then | |||||
| echo "skipping invalid tag: $TAG" | |||||
| exit 1 | |||||
| fi | |||||
| sed -i "s/ARG CALIBRE_RELEASE\=.*/ARG CALIBRE_RELEASE\=\"${TAG:1}\"/" Dockerfile | |||||
| if git diff --exit-code Dockerfile; then | |||||
| echo "Dockerfile already on ${TAG}" | |||||
| exit 0 | |||||
| fi | |||||
| git add Dockerfile | |||||
| git commit -m "update Calibre to ${TAG}" | |||||
| git tag -f "${TAG}" | |||||
| git push -f --tags | |||||
| git push origin main | |||||
| @ -0,0 +1,6 @@ | |||||
| FROM mariadb | |||||
| LABEL maintainer="Celestino Rey <creylopez@yahoo.es>" | |||||
| # Install any necessary packages | |||||
| RUN apt-get update | |||||
| RUN apt install -y mysql-client | |||||
| @ -0,0 +1,3 @@ | |||||
| docker build --no-cache -t creylopez/mariadb:1.0 . | |||||
| docker push creylopez/mariadb:1.0 | |||||
| @ -0,0 +1,3 @@ | |||||
| docker build --no-cache -t creylopez/phpmysql:1.0 . | |||||
| docker push creylopez/phpmysql:1.0 | |||||
| @ -0,0 +1 @@ | |||||
| kubectl create secret generic regcred --from-file=.dockerconfigjson=$HOME/.docker/config.json --type=kubernetes.io/dockerconfigjson | |||||
| @ -0,0 +1,2 @@ | |||||
| FROM nginx | |||||
| @ -0,0 +1,16 @@ | |||||
| docker stop local-registry | |||||
| docker rm local-registry | |||||
| docker run -d -p 5001:5000 --name local-registry registry:2 | |||||
| echo "Para verificar: " | |||||
| echo "$ docker container ls -a |grep local-registry" | |||||
| echo "\n" | |||||
| echo "Para probar:" | |||||
| echo "$ docker pull nginx:latest" | |||||
| echo "$ docker tag nginx:latest localhost:5001/minginx:latest" | |||||
| echo "$ docker push localhost:5001/minginx:latest" | |||||
| echo "\n" | |||||
| echo "Entrar en la imagen:" | |||||
| echo "$ docker exec -it local-registry sh" | |||||
| echo "# cd /var/lib/registry" | |||||
| echo "# ls docker .... etcetera" | |||||
| @ -0,0 +1,11 @@ | |||||
| # Esta no la he probado todavía, pero da pistas | |||||
| https://kubeops.net/blog/creating-a-local-docker-registry | |||||
| # Esta es sin autenticación. kubectl falla al acceder al registry | |||||
| https://k21academy.com/docker-kubernetes/how-to-set-up-your-own-local-docker-registry-a-step-by-step-guide/ | |||||
| # probando | |||||
| https://phoenixnap.com/kb/set-up-a-private-docker-registry | |||||
| @ -0,0 +1,2 @@ | |||||
| kubectl run nginx-pod --image=localhost:5000/minginx:latest | |||||
| @ -0,0 +1,37 @@ | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: docker-registry | |||||
| spec: | |||||
| ports: | |||||
| - port: 5000 | |||||
| targetPort: 5000 | |||||
| selector: | |||||
| app: registry | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Pod | |||||
| metadata: | |||||
| name: docker-registry-pod | |||||
| labels: | |||||
| app: registry | |||||
| spec: | |||||
| containers: | |||||
| - name: registry | |||||
| image: registry:2 | |||||
| volumeMounts: | |||||
| - name: repo-vol | |||||
| mountPath: "/var/lib/registry" | |||||
| ports: | |||||
| - containerPort: 5000 | |||||
| name: registryport | |||||
| volumes: | |||||
| - name: repo-vol | |||||
| persistentVolumeClaim: | |||||
| claimName: docker-repo-pvc | |||||
| - name: certs-vol | |||||
| secret: | |||||
| secretName: certs-secret | |||||
| - name: auth-vol | |||||
| secret: | |||||
| secretName: auth-secret | |||||
| @ -0,0 +1,22 @@ | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolume | |||||
| metadata: | |||||
| name: docker-repo-pv | |||||
| spec: | |||||
| capacity: | |||||
| storage: 1Gi | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| hostPath: | |||||
| path: /mnt/Externo/registry | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: PersistentVolumeClaim | |||||
| metadata: | |||||
| name: docker-repo-pvc | |||||
| spec: | |||||
| accessModes: | |||||
| - ReadWriteOnce | |||||
| resources: | |||||
| requests: | |||||
| storage: 1Gi | |||||
| @ -0,0 +1,3 @@ | |||||
| # mkdir -p registry/{nginx,auth} | |||||
| # mkdir -p registry/nginx/{conf.d,ssl} | |||||
| # cd registry && tree | |||||
| @ -0,0 +1 @@ | |||||
| client_max_body_size 2G; | |||||
| @ -0,0 +1,27 @@ | |||||
| upstream docker-registry { | |||||
| server registry:5000; | |||||
| } | |||||
| server { | |||||
| listen 80; | |||||
| server_name registry.k8s-server; | |||||
| return 301 https://registry.k8s-server$request_uri; | |||||
| } | |||||
| server { | |||||
| listen 443 ssl http2; | |||||
| server_name registry.k8s-server; | |||||
| ssl_certificate /etc/nginx/ssl/fullchain.pem; | |||||
| ssl_certificate_key /etc/nginx/ssl/privkey.pem; | |||||
| error_log /var/log/nginx/error.log; | |||||
| access_log /var/log/nginx/access.log; | |||||
| location / { | |||||
| if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { | |||||
| return 404; | |||||
| } | |||||
| proxy_pass http://docker-registry; | |||||
| 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_read_timeout 900; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,36 @@ | |||||
| version: '3' | |||||
| services: | |||||
| registry: | |||||
| image: registry:2 | |||||
| restart: always | |||||
| ports: | |||||
| - "5000:5000" | |||||
| environment: | |||||
| REGISTRY_AUTH: htpasswd | |||||
| REGISTRY_AUTH_HTPASSWD_REALM: Registry-Realm | |||||
| REGISTRY_AUTH_HTPASSWD_PATH: /auth/registry.passwd | |||||
| REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data | |||||
| volumes: | |||||
| - registrydata:/data | |||||
| - ./auth:/auth | |||||
| networks: | |||||
| - mynet | |||||
| nginx: | |||||
| image: nginx:alpine | |||||
| container_name: nginx | |||||
| restart: unless-stopped | |||||
| tty: true | |||||
| ports: | |||||
| - "80:80" | |||||
| - "443:443" | |||||
| volumes: | |||||
| - ./nginx/conf.d/:/etc/nginx/conf.d/ | |||||
| - ./nginx/ssl/:/etc/nginx/ssl/ | |||||
| networks: | |||||
| - mynet | |||||
| networks: | |||||
| mynet: | |||||
| driver: bridge | |||||
| volumes: | |||||
| registrydata: | |||||
| driver: local | |||||
| @ -0,0 +1,2 @@ | |||||
| creylopez:$2y$05$Cb2PH3cbA.geRwxOpKIVTO1pmbuWHyYpXgPuBw6MoD2JEcC/WoH1G | |||||
| @ -0,0 +1,30 @@ | |||||
| -----BEGIN CERTIFICATE----- | |||||
| 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 | |||||
| -----END CERTIFICATE----- | |||||
| @ -0,0 +1,52 @@ | |||||
| -----BEGIN PRIVATE KEY----- | |||||
| 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 | |||||
| 0rB4NTFlZj6aLGuXdEpahpmitNJ0O5s= | |||||
| -----END PRIVATE KEY----- | |||||
| @ -0,0 +1,78 @@ | |||||
| borrarActual () { | |||||
| echo ">>>> Borrando registro actual..." | |||||
| kubectl delete -f registry-deployment.yaml | |||||
| kubectl delete -f registry-pv.yaml | |||||
| echo ">>>> Borrando secrets actuales..." | |||||
| kubectl delete secret auth-secret | |||||
| kubectl delete secret certs-secret | |||||
| kubectl delete secret reg-cred-secret | |||||
| kubectl delete pod/nginx-pod | |||||
| } | |||||
| step1 () { | |||||
| echo "Step 1: Creating files for authentication\n\n" | |||||
| echo ">>>> Creando directorios..." | |||||
| mkdir -p /registry && cd "$_" | |||||
| rm -rf auth/ | |||||
| rm -rf certs/ | |||||
| echo "Creando certificados..." | |||||
| mkdir certs | |||||
| openssl req -x509 -newkey rsa:4096 -days 365 -nodes -sha256 -keyout certs/tls.key -out certs/tls.crt -subj "/CN=docker-registry" -addext "subjectAltName = DNS:docker-registry" | |||||
| echo "Creando autorizaciones..." | |||||
| mkdir auth | |||||
| docker run --rm --entrypoint htpasswd registry:2.7.0 -Bbn creylopez Rey-1176 > auth/htpasswd | |||||
| } | |||||
| step2 () { | |||||
| echo "Step 2: Using secrets to mount the certificates\n\n" | |||||
| echo "Creando secret certs-secret..." | |||||
| kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key | |||||
| echo "Creando secret auth-secret..." | |||||
| kubectl create secret generic auth-secret --from-file=/registry/auth/htpasswd | |||||
| } | |||||
| step3() { | |||||
| echo "Step 3: Creating Persistent Volume and Claim for repository storage\n\n" | |||||
| kubectl create -f /home/creylopez/k8s-cluster-projects/MiRegistry/registry-pv.yaml | |||||
| } | |||||
| step4() { | |||||
| echo "Step 4: Creating the Registry Pod\n\n" | |||||
| kubectl create -f /home/creylopez/k8s-cluster-projects/MiRegistry/registry-deployment.yaml | |||||
| } | |||||
| step5() { | |||||
| echo "Step 5: Allowing access to the registry\n\n" | |||||
| echo "Copio tls.cert a /etc..." | |||||
| sudo cp certs/tls.crt /etc/docker/certs.d/docker-registry\:32000/ca.crt | |||||
| } | |||||
| step6() { | |||||
| echo "Step 6: Testing our Private Docker Registry" | |||||
| docker login docker-registry:32000 -u creylopez -p Rey-1176 | |||||
| echo "Creando secret reg-cred-secret..." | |||||
| kubectl create secret docker-registry reg-cred-secret --docker-server=docker-registry:32000 --docker-username=creylopez --docker-password=Rey-1176 | |||||
| echo "Descargo imagen nginx..." | |||||
| docker pull nginx | |||||
| echo "... la etiqueto..." | |||||
| docker tag nginx:latest docker-registry:32000/minginx:1 | |||||
| echo "... y la subo al registry... " | |||||
| docker push docker-registry:32000/minginx:1 | |||||
| #kubectl exec docker-registry-pod -it -- sh | |||||
| } | |||||
| prueba() { | |||||
| echo "Creo un pod con la nueva imagen..." | |||||
| kubectl run nginx-pod --image=docker-registry:32000/minginx:v1 --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "reg-cred-secret"}] } }' | |||||
| } | |||||
| borrarActual | |||||
| #step1 | |||||
| #step2 | |||||
| #step3 | |||||
| #step4 | |||||
| #step5 | |||||
| #step6 | |||||
| #final | |||||
| @ -0,0 +1,21 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: nginx-deployment | |||||
| labels: | |||||
| app: nginx | |||||
| spec: | |||||
| selector: | |||||
| matchLabels: | |||||
| app: nginx | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: nginx | |||||
| spec: | |||||
| containers: | |||||
| - name: nginx | |||||
| image: mynginx:local | |||||
| imagePullPolicy: Always | |||||
| ports: | |||||
| - containerPort: 80 | |||||
| @ -1,2 +1,2 @@ | |||||
| kubectl run nginx-pod --image=docker-registry:5000/mynginx:v1 --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "reg-cred-secret"}] } }' | |||||
| kubectl run nginx-pod --image=docker-registry:32000/minginx:2.0 --overrides='{ "apiVersion": "v1", "spec": { "imagePullSecrets": [{"name": "reg-cred-secret"}] } }' | |||||
| @ -1,2 +0,0 @@ | |||||
| # creando un secret | |||||
| kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key | |||||
| @ -1,3 +0,0 @@ | |||||
| # ya hay otra shell para esto | |||||
| # Crea el pod | |||||
| #kubectl create -f registry-deployment.yaml | |||||
| @ -1,4 +1,5 @@ | |||||
| # Crear htpasswd para autenticación de usuario | # Crear htpasswd para autenticación de usuario | ||||
| sudo docker run --rm --entrypoint htpasswd registry:2.6.2 -Bbn creylopez Rey-1176 | |||||
| mkdir auth | |||||
| sudo docker run --rm --entrypoint htpasswd registry:2.6.2 -Bbn creylopez Rey-1176 > auth/htpasswd | |||||
| echo "Copia la salida y pegala en /registry/auth/htpasswd" | echo "Copia la salida y pegala en /registry/auth/htpasswd" | ||||
| @ -0,0 +1,3 @@ | |||||
| # creando un secret | |||||
| #kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key --server=https://k8s-server:6443 | |||||
| kubectl create secret tls certs-secret --cert=/registry/certs/tls.crt --key=/registry/certs/tls.key | |||||
| @ -0,0 +1,5 @@ | |||||
| # | |||||
| cd /registry | |||||
| sudo mkdir /etc/docker/certs.d/docker-registry:32000 | |||||
| sudo cp certs/tls.crt /etc/docker/certs.d/docker-registry\:32000/ca.crt | |||||
| @ -0,0 +1 @@ | |||||
| kubectl create secret docker-registry reg-cred-secret --docker-server=k8s-server:32000 --docker-username=creylopez --docker-password=Rey-1176 | |||||
| @ -0,0 +1,4 @@ | |||||
| # ya hay otra shell para esto | |||||
| # Crea el pod | |||||
| kubectl create -f registry-pv.yaml | |||||
| kubectl create -f registry-deployment.yaml | |||||
| @ -0,0 +1,7 @@ | |||||
| docker pull nginx | |||||
| docker tag nginx:latest docker-registry:32000/mynginx:v1 | |||||
| docker push docker-registry:32000/mynginx:v1 | |||||
| # para probar | |||||
| # kubectl exec docker-registry-pod -it -- sh | |||||
| @ -1,2 +0,0 @@ | |||||
| docker build --no-cache -t docker-registry:32000/phpmysql:2.0 . | |||||
| docker push docker-registry:32000/phpmysql:2.0 | |||||
| @ -0,0 +1,24 @@ | |||||
| # Backup date | |||||
| today=$(date "+%Y_%m_%d-%H_%M_%S") | |||||
| echo "Current date: $today" | |||||
| # build up filename | |||||
| # destination folder (change to your own needs) | |||||
| #BACKUP_FOLDER=/tmp | |||||
| BACKUP_FOLDER=/mnt/Externo/copiasFF | |||||
| file_name=$BACKUP_FOLDER/bkup_fireflyiii | |||||
| new_name=$file_name-$today.sql | |||||
| echo "Backup file name: " "$new_name" | |||||
| sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n firefly|grep iii-mysql|cut -f1 -d' '` -n firefly -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Rey-1176 fireflyiii > $new_name | |||||
| message="Backup stored "$today | |||||
| sudo -u creylopez cat $new_name | mail -s "FireflyIII backup finished" "creylopez@yahoo.es" | |||||
| #sudo rm $new_name | |||||
| @ -0,0 +1,24 @@ | |||||
| # Backup date | |||||
| today=$(date "+%Y_%m_%d-%H_%M_%S") | |||||
| echo "Current date: $today" | |||||
| # build up filename | |||||
| # destination folder (change to your own needs) | |||||
| BACKUP_FOLDER=/tmp | |||||
| file_name=$BACKUP_FOLDER/bkup_gogs | |||||
| new_name=$file_name-$today.sql | |||||
| echo "Backup file name: " "$new_name" | |||||
| #sudo docker exec `sudo docker container ls | grep mysql_gogs | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 gogs > $new_name | |||||
| sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n gogs|grep mysql|cut -f1 -d' '` -n gogs -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Dsa-0213 gogs > $new_name | |||||
| message="Backup stored "$today | |||||
| sudo -u creylopez cat $new_name | mail -s "Gogs backup finished" "creylopez@yahoo.es" | |||||
| sudo rm $new_name | |||||
| @ -0,0 +1,24 @@ | |||||
| # Backup date | |||||
| today=$(date "+%Y_%m_%d-%H_%M_%S") | |||||
| echo "Current date: $today" | |||||
| # build up filename | |||||
| # destination folder (change to your own needs) | |||||
| BACKUP_FOLDER=/tmp | |||||
| file_name=$BACKUP_FOLDER/bkup_mediawiki | |||||
| new_name=$file_name-$today.sql | |||||
| echo "Backup file name: " "$new_name" | |||||
| #sudo docker exec `sudo docker container ls | grep mysql_mediawiki | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 mediawiki > $new_name | |||||
| sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n mediawiki|grep mysql|cut -f1 -d' '` -n mediawiki -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Dsa-0213 mediawiki > $new_name | |||||
| message="Backup stored "$today | |||||
| sudo -u creylopez cat $new_name | mail -s "Mediawiki backup finished" "creylopez@yahoo.es" | |||||
| sudo rm $new_name | |||||
| @ -0,0 +1,29 @@ | |||||
| # Backup date | |||||
| today=$(date "+%Y_%m_%d-%H_%M_%S") | |||||
| echo "Current date: $today" | |||||
| # build up filename | |||||
| # destination folder (change to your own needs) | |||||
| BACKUP_FOLDER=/tmp | |||||
| file_name=$BACKUP_FOLDER/bkup_nc | |||||
| new_name=$file_name-$today.sql | |||||
| echo "Backup file name: " "$new_name" | |||||
| #sudo docker exec `sudo docker container ls | grep mysql_gogs | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 gogs > $new_name | |||||
| sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n nextcloud|grep mysql|cut -f1 -d' '` -n nextcloud -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Dsa-0213 nextcloud_db > $new_name | |||||
| message="Backup stored "$today | |||||
| sudo zip $new_name.zip $new_name | |||||
| #sudo -u creylopez mail -s "Nextcloud backup finished" "creylopez@yahoo.es" -a $new_name.zip | |||||
| #sudo -u creylopez cat $new_name | mail -s "Nextcloud backup finished" "creylopez@yahoo.es" | |||||
| sudo -u creylopez echo "Nextcloud backup adjunto" |mail -s "Backup de nextcloud" creylopez@yahoo.es -A $new_name.zip | |||||
| #sudo rm $new_name.* | |||||
| @ -0,0 +1,24 @@ | |||||
| # Backup date | |||||
| today=$(date "+%Y_%m_%d-%H_%M_%S") | |||||
| echo "Current date: $today" | |||||
| # build up filename | |||||
| # destination folder (change to your own needs) | |||||
| BACKUP_FOLDER=/tmp | |||||
| file_name=$BACKUP_FOLDER/bkup_repostajes | |||||
| new_name=$file_name-$today.sql | |||||
| echo "Backup file name: " "$new_name" | |||||
| #sudo docker exec `sudo docker container ls | grep mysql_repostajes | cut -f1 -d' '` /usr/bin/mysqldump -u root --password=Dsa-0213 repostajes > $new_name | |||||
| sudo kubectl --kubeconfig /home/creylopez/.kube/config exec `kubectl --kubeconfig /home/creylopez/.kube/config get pod -n repostajes|grep mysql|cut -f1 -d' '` -n repostajes -- /usr/bin/mysqldump --column-statistics=0 -u root --password=Dsa-0213 automoviles > $new_name | |||||
| message="Backup stored "$today | |||||
| sudo -u creylopez cat $new_name | mail -s "Repostajes backup finished" "creylopez@yahoo.es" | |||||
| sudo rm $new_name | |||||