commit inicial

main
Roberto Rodríguez 1 year ago
commit 1ca994732c

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "themes/hugo-theme-stack"]
path = themes/hugo-theme-stack
url = https://github.com/CaiJimmy/hugo-theme-stack/

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Jimmy Cai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,54 @@
## Hugo Theme Stack Starter Template
This is a quick start template for [Hugo theme Stack](https://github.com/CaiJimmy/hugo-theme-stack). It uses [Hugo modules](https://gohugo.io/hugo-modules/) feature to load the theme.
It comes with a basic theme structure and configuration. GitHub action has been set up to deploy the theme to a public GitHub page automatically. Also, there's a cron job to update the theme automatically everyday.
To get started:
1. Click *Use this template*, and create your repository on GitHub.
![Step 1](https://user-images.githubusercontent.com/5889006/156916624-20b2a784-f3a9-4718-aa5f-ce2a436b241f.png)
2. Once the repository is created, create a GitHub codespace asociated with it.
![Create codespace](https://user-images.githubusercontent.com/5889006/156916672-43b7b6e9-4ffb-4704-b4ba-d5ca40ffcae7.png)
3. And voila! You're ready to go. The codespace has been configured with the latest version of Hugo extended, just run `hugo server` in the terminal and see your new site in action.
4. Check `config` folder for the configuration files. You can edit them to suit your needs. Make sure to update the `baseurl` property in `config/_default/config.toml` to your site's URL.
5. Once you're done editing the site, just commit it and push it. GitHub action will deploy the site automatically to GitHub page asociated with the repository.
![GitHub action](https://user-images.githubusercontent.com/5889006/156916881-90b8bb9b-1925-4e60-9d7a-8026cda729bf.png)
---
In case you don't want to use GitHub codespace, you can also run this template in your local machine. **You need to install Git, Go and Hugo extended locally.**
### Update theme manually
Run:
```bash
hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v3
hugo mod tidy
```
> This starter template has been configured with `v3` version of theme. Due to the limitation of Go module, once the `v4` or up version of theme is released, you need to update the theme manually. (Modifying `config/module.toml` file)
### Deploy to another static page hostings
If you want to build this site using another static page hosting, you need to make sure they have Go installed in the machine.
<details>
<summary>Vercel</summary>
You need to overwrite build command to install manually Go:
```
amazon-linux-extras install golang1.11 && hugo --gc --minify
```
![](https://user-images.githubusercontent.com/5889006/156917172-01e4d418-3469-4ffb-97e4-a905d28b8424.png)
Make sure also to specify Hugo version in the environment variable `HUGO_VERSION` (Use the latest version of Hugo extended):
![Environment variable](https://user-images.githubusercontent.com/5889006/156917212-afb7c70d-ab85-480f-8288-b15781a462c0.png)
</details>

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

@ -0,0 +1,16 @@
# Change baseurl before deploy
baseurl = "http://localhost"
languageCode = "es-es"
paginate = 5
title = "AdMichin.es"
# Theme i18n support
# Available values: en, fr, id, ja, ko, pt-br, zh-cn, zh-tw, es, de, nl, it, th, el, uk, ar
DefaultContentLanguage = "es"
# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
# This will make .Summary and .WordCount behave correctly for CJK languages.
hasCJKLanguage = false
# Change it to your Disqus shortname before using
disqusShortname = "hugo-theme-stack"

@ -0,0 +1,7 @@
# Uncomment this file to enable multilanguage site support
#[en]
#languageName = "English"
#languagedirection = "ltr"
#title = "Example Site"
#weight = 1

@ -0,0 +1,17 @@
# Markdown renderer configuration
[goldmark.renderer]
unsafe = false
[tableOfContents]
endLevel = 4
ordered = true
startLevel = 2
[highlight]
noClasses = false
codeFences = true
guessSyntax = true
lineNoStart = 1
lineNos = true
lineNumbersInTable = true
tabWidth = 4

@ -0,0 +1,24 @@
# Configure main menu and social menu
#[[main]]
#identifier = "home"
#name = "Home"
#url = "/"
#[main.params]
#icon = "home"
#newtab = true
[[social]]
identifier = "github"
name = "GitHub"
url = "https://github.com/CaiJimmy/hugo-theme-stack"
[social.params]
icon = "brand-github"
[[social]]
identifier = "twitter"
name = "Twitter"
url = "https://twitter.com"
[social.params]
icon = "brand-twitter"

@ -0,0 +1,2 @@
[[imports]]
path = "github.com/CaiJimmy/hugo-theme-stack/v3"

@ -0,0 +1,148 @@
# Pages placed under these sections will be shown on homepage and archive page.
mainSections = ["post"]
# Output page's full content in RSS.
rssFullContent = true
[footer]
since = 2023
customText = ""
[dateFormat]
published = "Jan 02, 2006"
lastUpdated = "Jan 02, 2006 15:04 MST"
[sidebar]
emoji = "🍥"
subtitle = "Roberto Rodríguez. DevOps | SysAdmin"
[sidebar.avatar]
enabled = true
local = true
src = "img/avatar.png"
[article]
math = true
readingTime = true
[article.license]
enabled = true
default = "Licensed under CC BY-NC-SA 4.0"
## Widgets
[[widgets.homepage]]
type = "search"
[[widgets.homepage]]
type = "archives"
[widgets.homepage.params]
limit = 5
[[widgets.homepage]]
type = "categories"
[widgets.homepage.params]
limit = 10
[[widgets.homepage]]
type = "tag-cloud"
[widgets.homepage.params]
limit = 10
[[widgets.page]]
type = "toc"
[opengraph.twitter]
site = ""
card = "summary_large_image"
[defaultImage.opengraph]
enabled = false
local = false
src = ""
[colorScheme]
toggle = true
default = "auto"
[imageProcessing.cover]
enabled = true
[imageProcessing.content]
enabled = true
## Comments
[comments]
enabled = true
provider = "disqus"
[comments.disqusjs]
shortname = ""
apiUrl = ""
apiKey = ""
admin = ""
adminLabel = ""
[comments.utterances]
repo = ""
issueTerm = "pathname"
label = ""
[comments.remark42]
host = ""
site = ""
locale = ""
[comments.vssue]
platform = ""
owner = ""
repo = ""
clientId = ""
clientSecret = ""
autoCreateIssue = false
[comments.waline]
serverURL = ""
lang = ""
visitor = ""
avatar = ""
emoji = ["https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo"]
requiredMeta = ["name", "email", "url"]
placeholder = ""
[comments.waline.locale]
admin = "Admin"
[comments.twikoo]
envId = ""
region = ""
path = ""
lang = ""
[comments.cactus]
defaultHomeserverUrl = "https://matrix.cactus.chat:8448"
serverName = "cactus.chat"
siteName = ""
[comments.giscus]
repo = ""
repoID = ""
category = ""
categoryID = ""
mapping = ""
lightTheme = ""
darkTheme = ""
reactionsEnabled = 1
emitMetadata = 0
[comments.gitalk]
owner = ""
admin = ""
repo = ""
clientID = ""
clientSecret = ""
[comments.cusdis]
host = ""
id = ""

@ -0,0 +1,3 @@
# Permalinks format of each content section
post = "/p/:slug/"
page = "/:slug/"

@ -0,0 +1,12 @@
# Related contents configuration
includeNewer = true
threshold = 60
toLower = false
[[indices]]
name = "tags"
weight = 100
[[indices]]
name = "categories"
weight = 200

@ -0,0 +1,8 @@
---
menu:
main:
name: Home
weight: 1
params:
icon: home
---

@ -0,0 +1,10 @@
---
title: Example Category
description: A description of this category
image:
# Badge style
style:
background: "#2a9d8f"
color: "#fff"
---

@ -0,0 +1,11 @@
---
title: "Archives"
date: 2022-03-06
layout: "archives"
slug: "archives"
menu:
main:
weight: 2
params:
icon: archives
---

@ -0,0 +1,33 @@
---
title: Links
links:
- title: GitHub
description: GitHub is the world's largest software development platform.
website: https://github.com
image: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
menu:
main:
weight: 4
params:
icon: link
comments: false
---
To use this feature, add `links` section to frontmatter.
This page's frontmatter:
```yaml
links:
- title: GitHub
description: GitHub is the world's largest software development platform.
website: https://github.com
image: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
- title: TypeScript
description: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
website: https://www.typescriptlang.org
image: ts-logo-128.jpg
```
`image` field accepts both local and external images.

@ -0,0 +1,13 @@
---
title: "Search"
slug: "search"
layout: "search"
outputs:
- html
- json
menu:
main:
weight: 3
params:
icon: search
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

@ -0,0 +1,19 @@
---
title: Hello World
description: Welcome to Hugo Theme Stack
slug: hello-world
date: 2022-03-06 00:00:00+0000
image: cover.jpg
categories:
- Example Category
tags:
- Example Tag
---
Welcome to Hugo theme Stack. This is your first post. Edit or delete it, then start writing!
For more information about this theme, check the documentation: https://docs.stack.jimmycai.com/
Want a site like this? Check out [hugo-theme-stack-stater](https://github.com/CaiJimmy/hugo-theme-stack-starter)
> Photo by [Pawel Czerwinski](https://unsplash.com/@pawel_czerwinski) on [Unsplash](https://unsplash.com/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -0,0 +1,188 @@
---
title: "Instalación Gitea"
date: 2023-06-14 08:16:38+0200
draft: false
image: cover.png
---
# Gitea
Gitea es una solución ligera de alojamiento de código gestionada por la comunidad y escrita en Go, tiene las principales características que tiene github, incluyendo actions. Ahora veremos la instalación de gitea en la VPS.
## Preparación
En mi caso voy a instalarlo utilizando `docker-compose`, para ello, y teniendo en cuenta que uso debian, es necesario ejecutar los siguientes comandos:
```shell
apt update
apt install -y docker.io docker-compose
```
## Instalación
Para instalarlo, voy a optar por la opción con una base de datos PostgreSQL. Para ello, en un directorio vacío creamos el siguiente fichero `docker-compose.yml` (cambiando las credenciales, claro):
```yaml
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:nightly
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=db:5432
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3200:3000"
- "222:22"
depends_on:
- db
db:
image: postgres:14
restart: always
environment:
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD=gitea
- POSTGRES_DB=gitea
networks:
- gitea
volumes:
- ./postgres:/var/lib/postgresql/data
```
y lo desplegamos con
```shell
docker-compose up -d
```
Con eso ya se habrían creado los contenedores. Además, para poder entrar en gitea desde fuera de la VPS usando el dominio, vamos a añadir el siguiente proxy inverso al servidor nginx:
```nginx
server {
if ($host ~ ^[^.]+\.admichin\.es$) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name gitea.admichin.es;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl on;
ssl_certificate /etc/letsencrypt/live/admichin.es-0001/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/admichin.es-0001/privkey.pem; # managed by Certbot
index index.html index.php index.htm index.nginx-debian.html;
server_name gitea.admichin.es;
location / {
proxy_pass http://localhost:3200;
include proxy_params;
}
}
```
Con esto hecho, si accedemos a [gitea.admichin.es](https://gitea.admichin.es) por primera vez, se abrirá la página de configuración:
![configuracion1](https://i.imgur.com/es0cMvq.png)
En esta configuración es importante poner el dominio (más abajo, no donde sale en la foto ya que esa es la configuración de la base de datos). Así como establecer la configuración de ssh y el nombre del sitio. Tras finalizar la configuración, o en la misma ya que es una opción, el primer usuario que se cree será el administrador. Con esto ya tendríamos gitea instalado y funcionando.
![principal](https://i.imgur.com/dAKzydC.png)
# Actions
Gitea, desde la versión 1.19 permite añadir actions, que son similares a las GitHub actions. Aunque actualicemos a dicha versión, no aparecerán, ya que tenemos que añadir lo siguiente al final del fichero de configuración, que se encuentra en `data/gitea/conf/app.ini`:
```app.ini
[actions]
ENABLED=true
```
Una vez activado, aparece la siguiente opción en el apartado de administración:
![actions](https://i.imgur.com/OeZEsB5.png)
Para el paso que irá a continuación, vamos a necesitar el token de registro. Para obtenerlo se accede al apartado de Runners y al botón de `Create a new Runner`:
![token](https://i.imgur.com/bpHH3qp.png)
## Runners
Un runner es una máquina que ejecuta las tareas de un workflow de actions. En mi caso voy a utilizar un contenedor como runner dentro de la VPS también, pero hay varios métodos:
### En local
Descargamos el binario de [https://gitea.com/gitea/act_runner](https://gitea.com/gitea/act_runner) adecuado para nuestro sistema y ejecutamos los siguientes comandos:
```shell
./act_runner register --no-interactive --instance <instance> --token <token>
```
Donde la instancia es la dirección o IP en la que esté alojada Gitea, y el token es el token que hemos obtenido previamente. Tras esto, ejecutamos el runner:
```shell
./act_runner daemon
```
### En contenedor
Para ejecutarlo con docker voy a usar docker-compose. para ello, creo un nuevo directorio con el siguiente fichero docker-compose.yml:
```yaml
version: "3"
services:
runner:
image: gitea/act_runner
restart: always
volumes:
- ./data/act_runner:/data
- /var/run/docker.sock:/var/run/docker.sock
environment:
- GITEA_INSTANCE_URL=instance
- GITEA_RUNNER_REGISTRATION_TOKEN=token
```
Al igual que en el caso anterior la instancia es la dirección o IP en la que esté alojada Gitea, y el token es el token que hemos obtenido previamente.
Una vez en ejecución, los runners aparecen de la siguiente manera:
![runners](https://i.imgur.com/iN7zF86.png)
## Activar actions
Aunque esté configurado, las actions están desactivadas por defecto en los repositorios. Para activarlas hay que acceder a la configuración, y en el apartado de ajustes avanzados activarlas:
![activar](https://i.imgur.com/C9gBaBP.png)
Podemos ver que se ha activado porque aparece el botón de actions en el repositorio, y podemos añadirlas como se añadirían en GitHub:
![boton](https://i.imgur.com/DHLtkJY.png)
# Enlaces de interés
- [Gitea Installation with Docker](https://docs.gitea.com/next/installation/install-with-docker)
- [Feature Preview: Gitea Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
- [Hacking on Gitea Actions](https://blog.gitea.io/2023/03/hacking-on-gitea-actions/)

@ -0,0 +1,5 @@
module github.com/CaiJimmy/hugo-theme-stack-starter
go 1.17
require github.com/CaiJimmy/hugo-theme-stack/v3 v3.16.0 // indirect

@ -0,0 +1,2 @@
github.com/CaiJimmy/hugo-theme-stack/v3 v3.16.0 h1:ZWF66g7aXA840CzsT4lv65wHSojqwY0Yj7KdvOkn5NA=
github.com/CaiJimmy/hugo-theme-stack/v3 v3.16.0/go.mod h1:IPmCXiIxlFSLFYS0tOmYP6ySLviyeNVSabyvSuaxD+I=

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
{"Target":"scss/style.min.8191399262444ab68b72a18c97392f5349be20a1615d77445be51e974c144cff.css","MediaType":"text/css","Data":{"Integrity":"sha256-gZE5kmJESraLcqGMlzkvU0m+IKFhXXdEW+Uel0wUTP8="}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

@ -0,0 +1 @@
Subproject commit aae9cf67db8661e86996f8808baf4f71c472d911
Loading…
Cancel
Save