laconic.com/README.md
2023-12-15 15:58:10 -05:00

101 lines
2.5 KiB
Markdown

# Laconic
Repository for Laconic's website, hosted on internal infrastructure.
To update it; ensure you have access, ssh in, rebuild the docker image, and redeploy it using stack orchestrator.
## Access
1) ensure you have a user on `abernathy` (ask Shane),
2) to your `~/.ssh/config` add
```
Host abernathy
Hostname abernathy.vdb.to
Port 12000
User zach
Host dugwaybeds.vdb.to
ProxyJump abernathy
```
then,
```
ssh user@dugwaybeds.vdb.to
```
Next, either deploy to staging or to production (see further below).
## Local development
To build and serve this site on your local machine:
### Install yarn
e.g,:
```
npm install -g yarn
```
### Set env
```
export NEXT_PUBLIC_DATOCMS_BYPASS_TYPE="local_json"
```
### Install the dependencies:
```
yarn
```
### Serve
Run the development server
```
yarn dev
```
## Staging
To run a temporary staging deployment,
- ensure none exists or remove it
- run `laconic-so --stack laconic-dot-com setup-repositories`
- navigate to `~/cerc/laconic.com`
- select the correct branch/commit
- https://laconic-staging.vdb.to points to port 3100 on the server, therefore:
- in the `package.json`, edit this field `"scripts":{ "dev": "next -p 3100",`
- run `export NEXT_PUBLIC_DATOCMS_BYPASS_TYPE="local_json"`
- use `tmux` then `yarn dev`; after a dozen or so seconds, the staging site should be live
- use `ctrl + b, d` to exit `tmux` and `tmux a` to re-enter it
## Production
Uses stack orchestrator. For example:
```
laconic-so --stack laconic-dot-com setup-repositories
laconic-so --stack laconic-dot-com build-containers
laconic-so --stack laconic-dot-com deploy init --output laconic-website-spec.yml --map-ports-to-host localhost-same
laconic-so --stack laconic-dot-com deploy create --spec-file laconic-website-spec.yml --deployment-dir lx-website
# stop here; remove old deployment
laconic-so deployment --dir lx-website start
```
For each user, future deployments can omit the `setup-repositories` command. Instead, you can `cd ~/cerc/laconic.com` and pull in the correct commit.
To update the site, right now today, use the above 5 commands, stopping after the 4th to remove the current deployment. It looks like:
```
docker ps
```
```
068675f32292 cerc/laconic-dot-com:local "docker-entrypoint.s…" 7 weeks ago Up 5 weeks 127.0.0.1:3000->3000/tcp laconic-ac6c84bb25793c5f943a87eb10b4d918-laconic-dot-com-1
```
To remove it, run `docker rm -f <the_above_container_id>`
Then, run `laconic-so deployment --dir lx-website start` and https://laconic.com should be live with your changes.