Skip to content

SpaceKatt/spacekatt-io

Repository files navigation

spacekatt-io

spacekatt-io CI CD spacekatt-io

Shared code for public website and other applications.

Build Toolchain

This project uses Rush Stack and Heft for build and test orchestration. Rush has the benefit of providing incremental builds, which makes it useful for use in the monorepo context (time savings).

Install node14, using nvm

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
source ~/.bashrc

# Install node14
nvm install 14
nvm use 14

Install pnpm, rush, and heft

npm install --global pnpm
pnpm install --global @microsoft/rush @rushstack/heft

Build all projects

rush update
rush build

# force rebuild by not using build cache
rush rebuild

Run $ rush update after installing new packages and fetching code from remote git repository.

Project Inventory

Project Description Source link
spacekatt.io The International SpaceKatt Station website, used to host content and other projects Source link
Minesweeper Minesweeper implementation, React 17 Hooks used as responsive application framework Source link

Testing

Each project is responsible for its own testing. All applications use heft (jest under the covers) as a test runner.

cd <app_dir>
heft test

Linting

Each project is responsible for defining its own linting rules.

Generally, projects use ESLint and Prettier. (TSLint is now deprecated.)

Install linting tools

pnpm install --global eslint prettier

Docker

To provide an artifact for CI/CD and ensure setup instructions are 100% discoverable and documented, a Dockerfile is present. The produced docker image may be used to serve the International SpaceKatt Station—and all bundled projects—locally at http://127.0.0.1/ (and accessible from your favorite browser).

The ngnix:alpine variant of NGINX is used to serve static assets from within a container. Static assests are built in the first stage, then copied over to the nginx:alpine base in the second stage, before finally configuring and exposing the nginx service.

Alpline allowed for the optimization of image size; a 668MB Docker image was reduced to 30.8MB through the use of a multi-stage, alpine-based build.

Build Docker Image

docker build -t spacekatt/spacekatt-io:latest .

Run Container Locally

docker image ls
docker run -d -p 80:80 spacekatt/spacekatt-io:latest

View site running from the container at http://127.0.0.1/ in your favorite browser.

Stop running container

# List running containers
docker ps
docker stop <container_name>

Inspect running container

# List running containers
docker ps
docker exec -it <container_name> /bin/sh

CI/CD Pipeline Inventory

Pipeline Description Badge
CI Pipeline Continuous integration that runs on pull request and push to main. Builds, lints, and tests projects in monorepo. spacekatt-io CI
CD Pipeline Continuous delivery pipeline that runs on push to release/*. Releases public website. CD spacekatt-io

The author set up the CD pipeline using this tutorial;

Observability

Each project is responsible for their own observability strategies. Please refer to the Project Inventory for links to READMEs with the relevant information.