import from old-repo

This commit is contained in:
Ansel Boero 2024-12-25 23:46:29 +01:00
parent a582505daf
commit 465a8a2081
11 changed files with 224 additions and 14 deletions

45
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,45 @@
name: Deploy Quartz site to GitHub Pages
on:
push:
branches:
- v4
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git info
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Dependencies
run: npm ci
- name: Build Quartz
run: npx quartz build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: public
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

15
content/_index.md Normal file
View File

@ -0,0 +1,15 @@
---
title: Homepage
---
# Welcome
Here, youll find reflections around my main interests: data, critical thinking, personal finance, software, cognitivism, and mathematics.
I primarily write for myself: improving your writing [helps](https://paulgraham.com/writes.html)improve your thinking. However, Ill be glad if some of my content proves useful to you as well.
The folder structure is heavily inspired by [[Jacky Zhao| JZhao]] [website](https://jzhao.xyz/) (Even though my personal Obsidian is following the [PARA Method](https://fortelabs.com/blog/para/), and I like the idea of living documents: I might one day shift the blog to this different structure):
- In [Essays](/essays/) you will find my most curated posts.
- [Thoughts](/thoughts) contains considerations around topics which were resonating sound during the writing period. They are dirtier than the Essays and I expect to update them over the time.
- [Notes](/notes/) contains condensed blocks of knowledge on a specific subject, and can be used as appendix to the essays and thoughts.
You may be interested on some specific topics; the [Tags](/tags) page will group the essays and thoughts by tags.

3
content/essays/index.md Normal file
View File

@ -0,0 +1,3 @@
---
title: essays
---

101
content/notes/Terraform.md Normal file
View File

@ -0,0 +1,101 @@
---
title: Terraform
date: 2024-12-23
tags:
- cloud
- data
- IaC
---
# What is it
- Infrastructure as Code (IaC)
- Manage Infrastructure (usually on Cloud) with **configuration files** rather than through UI
- Advantages:
- Versionable
- Repeatable and Reusable (easy to create dev, test, Prod envs by using same files)
- Consistent (You know where to find active instances and where to drop them)
- Declarative Language
- Steps:
- **Scope**: Identify the Infrastructures (individual unit of services, e.g. Compute Instance, VPN, etc)
- **Author**: Write the configuration
- **Initialize**: Install the plugins needed by Terraform
- **Plan**: Preview the Changes Terraform will make to match your configurations
- **Apply**: Make the planned changes
# Build - The Blocks
- **terraform**: list the needed providers
- backend: where to store the state file. Local by default.
- **provider**: initializes each provider
- **resource**: List all the resources.
- Double entry name (uniqueness): resource name + personal identifier
- You can then refer a resource into another resource (e.g. line 32 `network = google_compute_network.vpc_network.name`)
```tf
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "6.14.1"
}
}
backend "gcs" {
bucket = "anselboero-website-dev-tfstate"
}
}
provider "google" {
project = var.project
region = var.region
zone = var.zone
}
resource "google_compute_network" "vpc_network" {
name = "terraform-network"
}
resource "google_compute_instance" "my_vm_instance" {
name = "terraform-instance"
machine_type = "f1-micro"
tags = ["web", "dev"]
boot_disk {
initialize_params {
image = "cos-cloud/cos-stable"
}
}
network_interface {
network = google_compute_network.vpc_network.name
access_config {
}
}
}
```
- Initialize the variables (any file .tf will be read by terraform):
- Empty { } will ask you to insert a value during `terraform apply`
```tf
variable "project" { }
variable "region" {
default = "us-central1"
}
variable "zone" {
default = "us-central1-c"
}
```
# Main Commands
- `terraform init`: when you initialize a new configuration
- `terraform apply`: create the infrastructure: will also apply changes in case you update the files.
Two types of changes:
- **Non destructive**: the resource will just be updated (e.g. adding a tag to a VM)
- **Destructive**: The old resource will be destroyed first and a new one will be created (e.g. changing image to a VM)
- `terraform destroy`: Delete all the resources.
# Open Questions
- I think it's not possible to save every single resource as a Tf object: For Example, how can you deploy the first resources without having initialized a Google Build Trigger via UI?
- How to structure the project?
# Resources
- https://developer.hashicorp.com/terraform/tutorials/gcp-get-started (all the 7 Tutorials) (opened on 2024-12-23)
- [Google Cloud Documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs)

3
content/notes/index.md Normal file
View File

@ -0,0 +1,3 @@
---
title: notes
---

View File

@ -0,0 +1,9 @@
---
title: Jacky Zhao
---
Also known as JZhao
- Creator of Quartz, static-site generator, used to generate this website. Thank you Jacky :)
# Resources
- [Quartz Doc](https://quartz.jzhao.xyz/)
- [Personal website](https://jzhao.xyz/)

4
content/tags/index.md Normal file
View File

@ -0,0 +1,4 @@
---
title: tags
---
find here all my tags

View File

@ -0,0 +1,3 @@
---
title: thoughts
---

View File

@ -13,17 +13,37 @@ export default ((opts?: Options) => {
const links = opts?.links ?? []
return (
<footer class={`${displayClass ?? ""}`}>
<p>
{i18n(cfg.locale).components.footer.createdWith}{" "}
<a href="https://quartz.jzhao.xyz/">Quartz v{version}</a> © {year}
</p>
<ul>
{Object.entries(links).map(([text, link]) => (
<li>
<a href={link}>{text}</a>
</li>
))}
</ul>
<div class="flex-container">
<div>
<p>
{i18n(cfg.locale).components.footer.createdWith}{" 💙 with "}
<a href="https://obsidian.md/">Obsidian</a>{", "}
<a href="https://quartz.jzhao.xyz/">Quartz v{version}</a>
{", and "}
<a href="https://pages.github.com/">Github Pages</a>.
<br />
This website does not use 🍪.
<br />
No AI was used to generate any kind of content.
</p>
<ul>
{Object.entries(links).map(([text, link]) => (
<li>
<a href={link}>{text}</a>
</li>
))}
</ul>
</div>
<div>
<p>Recently watched
<br />
<a href="https://www.imdb.com/title/tt14253846/?ref_=tt_mv_close">Speak No Evil</a>
</p>
<img
src="https://m.media-amazon.com/images/M/MV5BOTJjMDMyMGYtZWU3ZS00OTVmLTg1ZWUtY2E4OGEyOGNmMjhiXkEyXkFqcGc@._V1_SX300.jpg"
width="40%"></img>
</div>
</div>
</footer>
)
}

View File

@ -233,9 +233,8 @@ export function renderPage(
))}
</Header>
<div class="popover-hint">
{beforeBody.map((BodyComponent) => (
<BodyComponent {...componentData} />
))}
{slug !== "index" &&
beforeBody.map((BodyComponent) => <BodyComponent {...componentData} />)}
</div>
</div>
<Content {...componentData} />

View File

@ -1,3 +1,11 @@
@use "./base.scss";
// put your custom CSS here!
.flex-container {
display: flex;
}
.flex-container > div {
margin: 10px;
padding: 15px;
}