diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..d11b3976d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 \ No newline at end of file diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 000000000..c6a251ad3 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,15 @@ +--- +title: Homepage +--- +# Welcome + +Here, you’ll 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, I’ll 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. \ No newline at end of file diff --git a/content/essays/index.md b/content/essays/index.md new file mode 100644 index 000000000..029407c67 --- /dev/null +++ b/content/essays/index.md @@ -0,0 +1,3 @@ +--- +title: essays +--- \ No newline at end of file diff --git a/content/notes/Terraform.md b/content/notes/Terraform.md new file mode 100644 index 000000000..2821b92cb --- /dev/null +++ b/content/notes/Terraform.md @@ -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) \ No newline at end of file diff --git a/content/notes/index.md b/content/notes/index.md new file mode 100644 index 000000000..a4801db4a --- /dev/null +++ b/content/notes/index.md @@ -0,0 +1,3 @@ +--- +title: notes +--- \ No newline at end of file diff --git a/content/people/Jacky Zhao.md b/content/people/Jacky Zhao.md new file mode 100644 index 000000000..429c9278b --- /dev/null +++ b/content/people/Jacky Zhao.md @@ -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/) \ No newline at end of file diff --git a/content/tags/index.md b/content/tags/index.md new file mode 100644 index 000000000..b48b7f205 --- /dev/null +++ b/content/tags/index.md @@ -0,0 +1,4 @@ +--- +title: tags +--- +find here all my tags \ No newline at end of file diff --git a/content/thoughts/index.md b/content/thoughts/index.md new file mode 100644 index 000000000..9155b7770 --- /dev/null +++ b/content/thoughts/index.md @@ -0,0 +1,3 @@ +--- +title: thoughts +--- \ No newline at end of file diff --git a/quartz/components/Footer.tsx b/quartz/components/Footer.tsx index cff28cbb9..a6f9ac72a 100644 --- a/quartz/components/Footer.tsx +++ b/quartz/components/Footer.tsx @@ -13,17 +13,37 @@ export default ((opts?: Options) => { const links = opts?.links ?? [] return ( ) } diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 9c530967b..02410943f 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -233,9 +233,8 @@ export function renderPage( ))}