Skip to content

Commit

Permalink
Agregando kube16 y v2m-gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
pablokbs committed May 16, 2019
1 parent ffe844c commit c1f0b96
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
varios/1/certs
.DS_Store
*.tfstate
extra/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Si el nombre del capítulo no tiene link, es porque no necesité postear ningún
13. [StatefulSets](./kubernetes/13) / [video](https://www.youtube.com/watch?v=Gp6LNymkw70)
14. [CI/CD](./kubernetes/14) [Repo con los archivos CircleCI](https://github.com/peladonerd/flisol2019)/ [video](https://youtu.be/o5-QPfh-piM)
15. [Wordpres + MySQL](./kubernetes/15) / [video](https://youtu.be/TnME3zam7Zo)
16. [ENVs y Secrets](./kubernetes/16) / [video](https://youtu.be/T7lRHHa4YxE)

4. Varios
1. [Creá tu sitio con SSL gratis con Docker y Let's encrypt](./varios/1) / [video](https://youtu.be/S2YFqf4L7l8)
Expand All @@ -56,6 +57,7 @@ Si el nombre del capítulo no tiene link, es porque no necesité postear ningún
2. [Docker secrets](./v2m/2) / [video](https://youtu.be/YbColFoz3ms)
3. [Minikube](./v2m/3) / [video](https://youtu.be/6e_sXAx7kts)
4. [OpenVPN](./v2m/4) / [video](https://youtu.be/TPVH6t8ylPg)
5. [GitLab](./v2m/5) / [video](https://youtu.be/bpWymXNsLAs)

6. Terraform
1. [Terraform 1](./terraform/1) / [video](https://youtu.be/1itPqkU8XZw)
Expand Down
13 changes: 13 additions & 0 deletions kubernetes/16/01-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
name: envar-demo
labels:
purpose: demonstrate-envars
spec:
containers:
- name: envar-demo-container
image: gcr.io/google-samples/node-hello:1.0
env:
- name: ENV1
value: "Esta es una variable comun"
7 changes: 7 additions & 0 deletions kubernetes/16/02-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: misecreto
type: Opaque
data:
password: PasswordSecreta
18 changes: 18 additions & 0 deletions kubernetes/16/03-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: envar-demo
labels:
purpose: demonstrate-envars
spec:
containers:
- name: envar-demo-container
image: gcr.io/google-samples/node-hello:1.0
env:
- name: ENV1
value: "Esta es una variable comun"
- name: ENV2
valueFrom:
secretKeyRef:
name: misecreto
key: password
4 changes: 4 additions & 0 deletions v2m/5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id_rsa.pub
gitlab/
.terraform/
terraform.tfstate.backup
9 changes: 9 additions & 0 deletions v2m/5/01_ssh_key.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Exportamos nuestra key SSH
# Tenes que copiar tu key a este directorio para que esto funcione

resource "digitalocean_ssh_key" "pelado" {
name = "pelado"
public_key = "${file("id_rsa.pub")}"
}

11 changes: 11 additions & 0 deletions v2m/5/02_droplet.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Creamos el droplet

resource "digitalocean_droplet" "git" {
image = "ubuntu-18-04-x64"
name = "git.pablokbs.com"
region = "nyc1"
size = "s-1vcpu-2gb"
user_data = "${file("userdata.yaml")}"
ssh_keys = ["${digitalocean_ssh_key.pelado.fingerprint}"]
}
15 changes: 15 additions & 0 deletions v2m/5/03_dns.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Creamos un dominio nuevo

resource "digitalocean_domain" "pablokbs" {
name = "pablokbs.com"
}

# Add a record to the domain
resource "digitalocean_record" "git" {
domain = "${digitalocean_domain.pablokbs.name}"
type = "A"
name = "git"
ttl = "10"
value = "${digitalocean_droplet.git.ipv4_address}"
}

7 changes: 7 additions & 0 deletions v2m/5/_provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "digitalocean_token" {}

# Configure the DigitalOcean Provider
provider "digitalocean" {
token = "${var.digitalocean_token}"
}

57 changes: 57 additions & 0 deletions v2m/5/userdata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#cloud-config
package_update: true
packages:
- docker.io
- docker-compose
write_files:
- path: /root/docker-compose.yaml
content: |
version: "3"
services:
gitlab:
image: gitlab/gitlab-ce
restart: always
ports:
- '2020:22'
expose:
- '80'
volumes:
- ./gitlab/config:/etc/gitlab
- ./gitlab/logs:/var/log/gitlab
- ./gitlab/data:/var/opt/gitlab
environment:
- GITLAB_OMNIBUS_CONFIG='external_url \'https://git.pablokbs.com\''
- VIRTUAL_HOST=git.pablokbs.com
- VIRTUAL_PORT=80
- LETSENCRYPT_HOST=git.pablokbs.com
- [email protected]
nginx:
image: jwilder/nginx-proxy
restart: always
ports:
- '80:80'
- '443:443'
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx/certs:/etc/nginx/certs:ro
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
labels:
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./nginx/certs:/etc/nginx/certs
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
volumes:
vhost:
html:
runcmd:
- docker-compose -f /root/docker-compose.yaml up -d

0 comments on commit c1f0b96

Please sign in to comment.