Skip to content

Commit

Permalink
Sync prod with master (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtshkmr authored Sep 23, 2024
2 parents 2228f94 + 49a6a05 commit 8711bc2
Show file tree
Hide file tree
Showing 196 changed files with 182,745 additions and 1,012 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

AWS_ACCESS_KEY_ID=secrettunnel
AWS_SECRET_ACCESS_KEY=secrettunnel
AWS_DEFAULT_REGION=ap-southeast-1
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/alchemy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ assignees: ''

### Present Context

<details>
<summary>Helping words...</summary>

Where we collectively investigate and interrogate the problem space and iteratively scope our approach.

Breakdown to landmarks that communicate shared context we are working towards through 2-tiered task list, CRUD list elements as development unfolds.
Expand All @@ -25,8 +28,16 @@ Strike the scope of code that reveals the most about the problem/solution FIRST
```
---

</details>

### Groundwork

<details>
<summary> Helping words...</summary>



Introduce us to the problem space. Write out what you already know about the terrain you are the recce commander enriching us with details beyond the fog of war.

Where have you tried applying and encountered difficulties?
Expand All @@ -42,8 +53,15 @@ Emphasis on previous or current practice to discover what is ugly, missing, or u
INPUT UR ANSWER HERE
```
---


</details>


### Reflection

<details>
<summary> Helping words...</summary>
Where the eternal wheel returns back to practice and what we finally implemented is to be outlined. You are the historian or archivist bringing clarity to future-yous and us about your foray.

Emphasis on approaching timeless solutions for well-defined problem space through distillation by decanting that which is un-needed and abstracting that which is essential to approaching the problem space.
Expand All @@ -54,4 +72,7 @@ Add any reflections and internal links to future potential and blindsides.
INPUT UR ANSWER HERE
```

</details>



86 changes: 86 additions & 0 deletions .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo Blog site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- blog

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.127.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: check stuff
working-directory: ./vyasa_blog
run: |
echo "Hello world, it's time to test the working directory: " && pwd
- name: Install Node.js dependencies
working-directory: ./vyasa_blog
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
TZ: America/Los_Angeles
working-directory: ./vyasa_blog
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./vyasa_blog/public


# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
70 changes: 38 additions & 32 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ on:

jobs:
test:

name: Build and Run Mix Test
runs-on: ubuntu-latest
runs-on: ubuntu-22.04 # Use a specific version for stability
name: Build OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} && Run Mix Test
services:
postgres:
image: postgres:latest
Expand All @@ -18,48 +17,55 @@ jobs:
POSTGRES_USER: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
otp: ['26.2']
elixir: ['1.16.3']
steps:
- uses: actions/checkout@v2
- name: Install dependecies for build
run: sudo apt-get install -y libncurses-dev libtinfo5
- name: Set up Elixir
uses: erlef/setup-elixir@885971a72ed1f9240973bd92ab57af8c1aa68f24
with:
elixir-version: '1.15.7' # Define the elixir version [required]
otp-version: '25' # Define the OTP version [required]
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
working-directory: ./
run: mix deps.get
- name: Run tests
env:
# use localhost for the host here because we are running the job on the VM.
# If we were running the job on in a container this would be postgres
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
working-directory: ./
run: mix test
- name: Checkout code
uses: actions/checkout@v4 # Pin to a specific version for stability

- name: Install dependencies for build
run: sudo apt-get update && sudo apt-get install -y libncurses-dev libtinfo5

- name: Setup Elixir and OTP
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Restore dependencies cache
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-

- name: Install dependencies
run: mix deps.get

- name: Run tests
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
run: mix test

deploy:
needs: test
name: Build & Deploy to Fly
runs-on: ubuntu-latest
runs-on: ubuntu-22.04 # Use a specific version for stability

steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@master
- name: Checkout code
uses: actions/checkout@v4 # Pin to a specific version for stability

- name: Deploy to Fly.io
uses: superfly/flyctl-actions@master
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
FLY_APP: vyasa
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ npm-debug.log

# Any Secret Configs
/config/*.secret.exs
/venv/
**.DS_Store
/vyasa_blog/public/ltximg/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vyasa_blog/themes/PaperMod"]
path = vyasa_blog/themes/PaperMod
url = https://github.com/adityatelange/hugo-PaperMod
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blog.vyasa.tv
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ RUN chown nobody /app

# copies over font files, updates debian runner's font cache:
RUN echo "...syncing font file(s)"
COPY ./priv/static/fonts/gotu/* /usr/share/fonts/truetype/
COPY ./priv/static/fonts/dn/* /usr/share/fonts/truetype/
COPY ./priv/static/fonts/ta/* /usr/share/fonts/truetype/
RUN apt-get update && apt-get install -y fontconfig
RUN fc-cache -f -v
RUN echo "...[DONE] syncing font file(s)"
Expand Down
105 changes: 86 additions & 19 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,104 @@ Wherever there be anything you dost not comprehend, cease to continue writing
-- Vyasa, Adi Parva - Mahabharatam
#+END_QUOTE

* Forms of Prior Art
** [[http://worrydream.com/refs/Nelson-ComputerLibDreamMachines1975.pdf#page=57][Xanadu Pattern]]

Ted Nelson the granddaddy of hypertext media, need I say more. The introduction to [[https://cs.brown.edu/people/nmeyrowi/LiteraryMachinesChapter2.pdf#page=12][Literary Machines]] is instructive to delineating the problem boundaries for literature
* What is the _*Vyasa Project*_?
=TODO=

* Getting Started Locally
** Basic setup instructions
*** Pre-requisites
1. Language Setup for Elixir. For any development environment of your choice, setup the necessary LSPs for elixir.
2. Docker
3. AWS cli
We use minio for local setup. At least a dummy profile needs to be set up using the aws cli.

*** First Setup Steps
We first setup the servers that get run and then do teh data migration steps.

We can use the [[file:docs/migration_ritesh.livemd::Migration steps][livemarkdown here]] for the data migration steps.

1. start docker, use the [[file:docker-compose.yml][docker-compose file]] already available. This will start the minio, pg and the like
#+begin_quote sh
docker compose up
#+end_quote
2. init aws cli, use a dummy profile
writing to the =~/.aws/credentials= file will work as well:

#+begin_quote toml
[default]
aws_access_key_id = secrettunnel
aws_secret_access_key = secrettunnel
#+end_quote
3. create the s3 bucket that shall be used
#+begin_quote sh
aws --endpoint-url http://localhost:9000 s3 mb s3://vyasa
#+end_quote
4. install the elixir deps
#+begin_quote elixir
mix deps.get
#+end_quote
5. do an initial db migration
#+begin_quote elixir
mix ecto.setup
#+end_quote
6. [Data seeding] Seed the text, written and events
This requires us to use a .json dump. [[./scripts/wow.json][Here's an example]] of such a dump.

We also need some voices files to init the voices. The voices repo is a private repo for now, can be found [[https://github.com/ve1ld/voices][here]].

For an easier time, use [[file:docs/migration_ritesh.livemd][this livemarkdown]].

*** Starting Steps
1. Start aux services by running docker compose up
2. Start the vyasa server
#+begin_quote bash
iex --sname vyasa --cookie foofoo --dbg pry -S mix phx.server
#+end_quote



* CLI Scripts Helpsheet
** 1. Running the shlokam.org scraper
#+begin_quote elixir
# build script
mix escript.build
# fetch from domain/path --storage :mode
./vyasa fetch shlokam.org/hanumanchalisa --storage file
#+end_quote

* Matter of Prior Work
We stand on the shoulders of giants. Here are some of the project that insipired this project into being started

** Prior Art
*** [[http://www.shivkumar.org/music/Thiruppavai-04-AazhiMazhaiKanna-Varali.htm][Shivkumar's Archives]]

** [[https://gwern.net/design][Design of Gwern.net]]
Shivkumar Kalyanaraman has compiled and archived a wealth of song recordings, paired with word-by-word meanings

Gwern has incorporated sidenotes instead of footnotes on wide windows, drop caps, smallcaps, collapsible sections, automatic inflation-adjusted currency, Wikipedia-style link icons & infoboxes, custom syntax highlighting, extensive local archives to fight linkrot (archive engine), and an ecosystem of “popup”/“popin” annotations & previews of links for frictionless browsing—the net effect of hierarchical structures with collapsing and instant popup access to excerpts enables iceberg-like pages where most information is hidden but the reader can easily drill down as deep as they wish.
*** [[https://shaivam.org/hindu-prayer-hub/detail/521][Shaivam]]

** [[https://edwardtufte.github.io/tufte-css/][Tufte.css]]
Built and maintained by devotees since 1996 a wealth of textual archives

Edward Tufte has developed a distinctive style in his works: simple, with well-set typography, extensive sidenotes, and elegant representations of graphs and charts
*** [[https://www.holy-bhagavad-gita.org/chapter/5/verse/8-9][Holy Bhagavad Gita]]

** [[https://ctext.org/introduction][CText]]
A tremendous effort by Jagadguru Kripaluji Trust

Dr. Donald Sturgeon has compiled a great corpus of ancient (in particular pre-Qin and Han dynasty) Chinese texts in an organized and searchable format which has been composed through an parallel passage interface, word lists for semantic linking and ancient text database.
** Forms of Prior Art as Inspiration
*** [[http://worrydream.com/refs/Nelson-ComputerLibDreamMachines1975.pdf#page=57][Xanadu Pattern ]]

Ted Nelson the granddaddy of hypertext media, need I say more. The introduction to [[https://cs.brown.edu/people/nmeyrowi/LiteraryMachinesChapter2.pdf#page=12][Literary Machines]] is instructive to delineating the problem boundaries for literature

** [[https://www.iwritewordsgood.com/apl/patterns/apl101.htm][Pattern Language]]
*** [[https://gwern.net/design][Design of Gwern.net]]

Christopher Alexander's pattern language arranges a series of steps, in a certain way that allows the process of unfolding to proceed. The rules are ordered – sequenced – to unfold each part of the environment being created, smoothly and coherently [[https://www.livingneighborhoods.org/ht-0/morphogenesis-two.htm][enlarging the whole]].

* Matter of Prior Art
** [[http://www.shivkumar.org/music/Thiruppavai-04-AazhiMazhaiKanna-Varali.htm][Shivkumar's Archives]]
Gwern has incorporated sidenotes instead of footnotes on wide windows, drop caps, smallcaps, collapsible sections, automatic inflation-adjusted currency, Wikipedia-style link icons & infoboxes, custom syntax highlighting, extensive local archives to fight linkrot (archive engine), and an ecosystem of “popup”/“popin” annotations & previews of links for frictionless browsing—the net effect of hierarchical structures with collapsing and instant popup access to excerpts enables iceberg-like pages where most information is hidden but the reader can easily drill down as deep as they wish.

Shivkumar Kalyanaraman has compiled and archived a wealth of song recordings, paired with word-by-word meanings
*** [[https://edwardtufte.github.io/tufte-css/][Tufte.css]]

** [[https://shaivam.org/hindu-prayer-hub/detail/521][Shaivam]]
Edward Tufte has developed a distinctive style in his works: simple, with well-set typography, extensive sidenotes, and elegant representations of graphs and charts

Built and maintained by devotees since 1996 a wealth of textual archives
*** [[https://ctext.org/introduction][CText]]

** [[https://www.holy-bhagavad-gita.org/chapter/5/verse/8-9][Holy Bhagavad Gita]]
Dr. Donald Sturgeon has compiled a great corpus of ancient (in particular pre-Qin and Han dynasty) Chinese texts in an organized and searchable format which has been composed through an parallel passage interface, word lists for semantic linking and ancient text database.

A tremendous effort by Jagadguru Kripaluji Trust
*** [[https://www.iwritewordsgood.com/apl/patterns/apl101.htm][Pattern Language]]
Christopher Alexander's pattern language arranges a series of steps, in a certain way that allows the process of unfolding to proceed. The rules are ordered – sequenced – to unfold each part of the environment being created, smoothly and coherently [[https://www.livingneighborhoods.org/ht-0/morphogenesis-two.htm][enlarging the whole]].
Loading

0 comments on commit 8711bc2

Please sign in to comment.