intern-resources/readme.md

150 lines
4.3 KiB
Markdown

# System Setup
## prepare macOS
instructions may differ depending if you're on an intel mac or an apple silicon mac
not sure which you have? [follow this guide to find out.](https://www.howtogeek.com/706226/how-to-check-if-your-mac-is-using-an-intel-or-apple-silicon-processor/)
### ssh
```sh
ssh-keygen -f thunderstrike_ed25519 -t ed25519 -N=''
ssh-add ~/.ssh/thunderstrike_ed25519
cat thunderstrike_ed25519 | pbcopy
```
go to your [gitea ssh settings](https://git.orionkindel.com/user/settings/keys) and paste the new key with CMD+V
### install docker
[install here](https://docs.docker.com/desktop/install/mac-install/)
### install homebrew
```sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install openssl git-lfs git zsh vscodium
```
## prepare windows
in an administrator powershell window: (press windows > type "powershell" > right click > run as administrator)
```powershell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
wsl --install -d Debian
```
then install [vscodium](https://vscodium.com/#install) (or [vscode](https://code.visualstudio.com/Download) if you prefer)
during install, there should be an "additional tasks > add vscode to PATH" option, this is strongly recommended.
### vscode in wsl mode
open vscode & install the [WSL vscode extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl)
### set up wsl
in powershell:
```powershell
debian -u root
```
```sh
echo "installing packages"
apt-get update -y
apt-get upgrade -y
apt-get install -y git git-lfs libssl-devel curl wget man neovim zsh
echo "adding docker repo"
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "installing docker"
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo "installing postgresql"
apt install -y postgresql-common
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
apt-get install -y postgresql-client-16
echo "changing default user to root, boot using systemd"
cat << "EOF" > /etc/wsl.conf
[user]
default = root
[boot]
systemd=true
EOF
```
if that went well, close the window and in a powershell window:
```powershell
wsl --shutdown
```
then reopen `debian` and try running:
```sh
code .
```
a windows 10 VSCode window should open with "WSL: Debian" displayed in the far bottom left corner of the window
if this all went well, continue to [common](#common) and assume code snippets should be run in `debian`.
feel free to use VSCode in windows for terminal and file editing!
## common
### docker login
go to [gitea application settings](https://git.orionkindel.com/user/settings/applications) and generate a new token:
| name | repo / organization access | permissions |
| -- | -- | -- |
| local docker | All (public, private, and limited) | package: Read, all others: No Access |
then copy the new token at the top of the page and paste it into this command:
```sh
docker login git.orionkindel.com -u <YOUR USERNAME> -p <PASTE TOKEN HERE>
```
e.g. `docker login git.orionkindel.com -u orion -p abcxyz123`
### everything else
```sh
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1
cat << "EOF" >> ~/.zshrc
source "$HOME/.asdf/asdf.sh"
source "$HOME/.asdf/completions/asdf.bash"
[ -s "~/.bun/_bun" ] && source "~/.bun/_bun"
export BUN_INSTALL="~/.bun"
export PATH=$PATH:$HOME/.bun/bin
EOF
asdf plugin add python
asdf plugin add nodejs
asdf plugin add rust
asdf plugin add bun
asdf plugin add purescript
asdf install nodejs 20.2.0
asdf install rust latest
asdf install bun latest
asdf install purescript latest
asdf global nodejs latest
asdf global rust latest
asdf global bun latest
asdf global purescript latest
npm install --global spago@next
```
## It all worked?
```sh
git clone git@git.orionkindel.com:ts/scraper
cd scraper
asdf install
bun install
spago build
# woohoo!
```