Notes - jpnws/bassline GitHub Wiki
- Install postgres:
brew install postgresql@15
- Start postgres:
sudo service postgresql start
- Launch
psql
prompt:sudo -u postgres psql
- Set default password:
postgres=# ALTER USER postgres PASSWORD 'password';
- Create database:
postgres=# CREATE DATABASE discodb;
bun install
bunx prisma migrate dev
bunx prisma generate
bunx prisma db seed
bun dev
- check
localhost:8000/boards/1/posts
Environment: WSL Ubuntu LTS v22
sudo apt update
sudo apt install git
git --version
# Set default branch, user.name, user.email
git config --global init.defaultBranch main
git config --global user.name "<your-name-on-github>"
git config --global user.email "<your-email-address-on-github>"
# confirm global config
git config --global --get user.name
git config --global --get user.email
git config --global --get init.defaultBranch
# confirm local config (execute this inside a repo)
git config --local --get user.name
git config --local --get user.email
git config --local --get init.defaultBranch
sudo apt update
sudo apt install zip
curl -fsSL https://bun.sh/install | bash
source /home/uname/.bashrc
bun
-
wsl -u root
on Windows Terminal. -
passwd <username>
-<username>
= ubuntu username - Type in new password.
git branch -r
- remote branches
git branch -a
- local & remote branches
git pull origin <remote-branch>
git checkout <branch>
git pull origin <branch>
git checkout -b <new-feature>
git status
git add <some-file>
git commit
sudo apt install curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install --lts
sudo apt update
sudo apt install postgresql
sudo service postgresql start
sudo -u postgres psql
postgres=# ALTER USER postgres PASSWORD '<postgres-password>';
This command switches to the postgres
system user on Linux for the duration of the psql
prompt session.
sudo -u postgres psql
-
\q
to quit prompt. -
\l
to list all databases. -
\c <db-name>
to switch DB to<db-name>
. -
\dt
to show all tables in db.
https://github.com/oven-sh/bun/issues/5320#issuecomment-1730927088
- Ensure that you have node.js installed on WSL. Instructions at the top.
- Trust the Prisma client package, so it can execute
postinstall
scripts:
package.json
:
"trustedDependencies": [
"@prisma/client"
],
- Now,
bunx prisma
commands will work.
Ensure that you have prisma/seed.ts
file.
Also, install tsx
as a dev dependency.
Then, have the following in package.json
:
"prisma": {
"seed": "tsx prisma/seed.ts"
}
bunx prisma db seed
bunx prisma migrate reset
This will:
- Drop the database
- Create a new database
- Apply all migrations
- Generate the Prisma client
bunx prisma migrate dev
bunx prisma migrate dev --name <migration-name>
- Create a docker image:
docker build -t <your-docker-img-name> .
- Run the docker image:
docker run -dp 8000:3000 <your-docker-img-name>
-
-d
is for detaching the image from terminal. -
-p
is for port mapping. -
8000
is the local port. -
3000
is the container's port.
-
- Follow instructions in the link below to install
doctl
and generate API token. - Once you have installed
doctl
and generated a token:- Execute
doctl auth init
and follow the prompt to input your token.
- Execute
- Validate that
doctl
is working:doctl account get
. - Go to your GitHub account -> Settings -> Applications.
- Add DigitalOcean app and then allow your repo to be connected.
- Create the app with
doctl
andspec.yaml
:doctl apps create --spec spec.yaml
-
Retrieve app ID with command:
doctl apps list --format ID
-
Update DigitalOcean's app with the updated spec (no quotes around app id):
doctl apps update <app-id> --spec spec.yaml