Skip to content

Commit

Permalink
docs: updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Jan 14, 2025
1 parent 4601cca commit 1dca1a4
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 6 deletions.
8 changes: 5 additions & 3 deletions docs/apps/docker-desktop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Provides **Docker**, **Kubernetes** runtime and CLI **tools** for local developm

> NOTE: you need either **Docker Desktop** ([free for personal use](https://www.docker.com/pricing/)) or **Rancher Desktop** (free). pick one only
**[Docker Desktop](https://www.docker.com/products/docker-desktop/)** Container Management and Kubernetes on the Desktop.
**[Docker Desktop](https://www.docker.com/products/docker-desktop/)** Container Management and Kubernetes on the Desktop.

Download and install the latest binary for your platform from [www.docker.com](https://www.docker.com/products/docker-desktop/).
Unpack and move `Docker Desktop.app` to `/Applications`
Expand All @@ -28,7 +28,7 @@ List of optional addons for kubernetes running in **Docker Desktop**

### Helm (optional)

Install [Helm](../devops/helm.md) package manager for Kubernetes. unlike Rancher-Desktop, Docker-Desktop doesnot include **Helm** by default.
Install [Helm](../devops/helm.md) package manager for Kubernetes. unlike Rancher-Desktop, Docker-Desktop doesnot include **Helm** by default.

```shell
brew install helm
Expand Down Expand Up @@ -70,6 +70,8 @@ docker context use docker-desktop
docker top CONTAINER
docker volume ls
docker network ls
docker system prune -a
docker system df
```

```shell
Expand Down Expand Up @@ -259,4 +261,4 @@ StevenACoffman's [Docker Best Practices and Antipatterns](https://gist.github.co
- [Faster Multi-Platform Builds: Dockerfile Cross-Compilation Guide](https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/)
- [Docker Compose: Fragments, Configs top-level element, Secrets top-level element](https://github.com/compose-spec/compose-spec/blob/master/spec.md#configs-top-level-element)
- [Kubernetes Ingress Vs Gateway API](https://medium.com/google-cloud/kubernetes-ingress-vs-gateway-api-647ee233693d)
- [Kubernetes & Traefik with local Wildcard certificates](https://hugo.md/post/kubernetes-and-traefik/)
- [Kubernetes & Traefik with local Wildcard certificates](https://hugo.md/post/kubernetes-and-traefik/)
2 changes: 2 additions & 0 deletions docs/apps/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Install local PostgreSQL database for your projects and PoCs.
We will be using [TimescaleDB](https://www.timescale.com/) as **PostgreSQL** which add extentions `pgvectorscale` and `pgai` to support [AI](https://www.timescale.com/ai)

**pgvectorscale** builds on **pgvector** with higher performance embedding search and cost-efficient storage for AI applications.

## Setup

1. At the command prompt, add the TimescaleDB Homebrew tap:
Expand Down
80 changes: 80 additions & 0 deletions docs/devops/compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Docker Compose Tips

## Features

- [ ] [Profiles](https://docs.docker.com/compose/profiles/)
- Is there any way to disable a service in `docker-compose.yml`? [Ref](https://stackoverflow.com/questions/37254881/is-there-any-way-to-disable-a-service-in-docker-compose-yml)
- Use `profiles` to store multiple variants of same service in one compose file. e.g., `[local, dev, prod]`
- Services without a `profiles` attribute are always enabled
- Auto-starting profiles and dependency resolution

When a service with assigned `profiles` is explicitly targeted on the command line its profiles are started automatically so you don't need to start them manually. This can be used for one-off services and debugging tools. As an example consider the following configuration:

```yaml
services:
backend:
image: backend

db:
image: mysql

db-migrations:
image: backend
command: myapp migrate
depends_on:
- db
profiles:
- tools
```
```sh
# Only start backend and db
$ docker compose up -d

# This runs db-migrations (and,if necessary, start db)
# by implicitly enabling the profiles `tools`
$ docker compose run db-migrations
```

- [ ] **docker-compose.override.yaml**
- Use to selectively `desable` on of the service in default `compose.yml`. [Ref](https://stackoverflow.com/questions/37254881/is-there-any-way-to-disable-a-service-in-docker-compose-yml/54214179#54214179)
- Scale the service to `0 replicas` with

```yaml
deploy:
replicas: 0
```

- Use to `docker-compose.override.yml` to override labels

```yaml
my_local_app:
labels:
- "traefik.http.routers.app1.rule=Host(`amazing.traefik.me`)"
```

- [ ] `traefik.me` is a magic domain name that provides wildcard DNS for any IP address. [Ref](https://github.com/pyrou/traefik.me/tree/master)
- [ ] To reach the container from another device on your local network, use the following docker label :

```yaml
- "traefik.http.routers.app1.rule=HostRegexp(`app1.{ip:.*}.traefik.me`)"
```

- [ ] Use <https://traefik.me> SSL certificates for local HTTPS without having to touch your /etc/hosts or your certificate CA. [Ref](https://gist.github.com/pyrou/4f555cd55677331c742742ee6007a73a)
- [ ] TLS for on-laptop and local network access your services
- [ ] reuse top-level config in compose.yaml
- [ ] top-level secrests in compose.yaml
- [ ] use **Github Actions** `secrets and variables` in Dockerfile during docker build on `Github Runners`

## TODO

- [ ] traefik:v3.0 <https://github.com/mannuelf/Traefik-and-Docker-VPS-setup>
- [ ] [Traefik without domain name](https://stackoverflow.com/questions/54511454/traefik-without-domain-name)
- [ ] [Docker-compose with Let's Encrypt: TLS Challenge](https://doc.traefik.io/traefik/user-guides/docker-compose/acme-tls/)
- [ ] Traefik gRPC Examples [With HTTP (h2c)](https://doc.traefik.io/traefik/user-guides/grpc/)

## Reference

- [traefik.me](https://github.com/pyrou/traefik.me/tree/master)
- [Use https://traefik.me SSL certificates for local HTTPS without having to touch your /etc/hosts or your certificate CA.](https://gist.github.com/pyrou/4f555cd55677331c742742ee6007a73a)
- traefik.me with Minor tweaks to the original - a Makefile and a 'donotstart' profile for the wget helper. [Ref](https://gist.github.com/pyrou/4f555cd55677331c742742ee6007a73a)
1 change: 0 additions & 1 deletion docs/essentials/essentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ brew install git
brew install gh # GitHub official command line tool.
# for first time use, run `gh auth login`


# Better CLI alternative Tools
brew install ack
brew install tree
Expand Down
24 changes: 22 additions & 2 deletions docs/platforms/node/pnpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,34 @@

## Install

> [!NOTE]
> Since v16.13, Node.js is shipping Corepack for managing package managers.
```shell
brew install pnpm
brew install node
# This will automatically install pnpm on your system.
corepack enable pnpm
```

Add following lines to [~/my/paths.zsh](../../../dotfiles/my/paths.zsh)

```shell
# pnpm
export PNPM_HOME=$HOME/Library/pnpm
export PATH=$PNPM_HOME:$PATH
```

## Project Setup

> [!NOTE]
> You can pin the version of pnpm used on your project using the following command
```shell
# for example to pin pnpm version for spectacular
cd ~/Developer/Work/SPA/spectacular
corepack use pnpm@latest-10
```

## Commands

```shell
Expand All @@ -29,7 +46,10 @@ pnpm ls prune
pnpm ls

pnpm audit
pnpm why
# find why a specific package installed
pnpm why vite
# for monorepo use -r to search all sub projects
pnpm why vite -r

# Publish all packages in topological order from the workspace.
pnpm publish -r
Expand Down

0 comments on commit 1dca1a4

Please sign in to comment.