Skip to content

Commit

Permalink
Merge pull request #534 from MatrixAI/feature-cli_migration
Browse files Browse the repository at this point in the history
CLI migration
  • Loading branch information
tegefaulkes authored Aug 3, 2023
2 parents fc82a3d + f7708f6 commit 3d16e2b
Show file tree
Hide file tree
Showing 210 changed files with 9,596 additions and 32,567 deletions.
380 changes: 0 additions & 380 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

96 changes: 0 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,6 @@ Our main website is https://polykey.io
npm install --save polykey
```

### Nix/NixOS

Building the releases:

```sh
nix-build ./release.nix --attr application
nix-build ./release.nix --attr docker
nix-build ./release.nix --attr package.linux.x64.elf
nix-build ./release.nix --attr package.windows.x64.exe
nix-build ./release.nix --attr package.macos.x64.macho
```

Install into Nix user profile:

```sh
nix-env -f ./release.nix --install --attr application
```

### Docker

Install into Docker:

```sh
docker load --input "$(nix-build ./release.nix --attr docker)"
```

## Development

Run `nix-shell`, and once you're inside, you can use:
Expand All @@ -91,14 +65,6 @@ npm run lint
npm run lintfix
```

### Generating GRPC Stubs

Once you update the `src/proto/schemas` files, run this to update the `src/proto/js` files.

```sh
npm run proto-generate
```

### Calling Commands

When calling commands in development, use this style:
Expand Down Expand Up @@ -127,65 +93,3 @@ npm publish --access public
git push
git push --tags
```

### Packaging Cross-Platform Executables

We use `pkg` to package the source code into executables.

This requires a specific version of `pkg` and also `node-gyp-build`.

Configuration for `pkg` is done in:

* `package.json` - Pins `pkg` and `node-gyp-build`, and configures assets and scripts.
* `utils.nix` - Pins `pkg` for Nix usage
* `release.nix` - Build expressions for executables

## Deployment

Image deployments are done automatically through the CI/CD. However manual scripts are available below for deployment.

### Deploying to AWS ECR:

#### Using skopeo

```sh
tag='manual'
registry_image='015248367786.dkr.ecr.ap-southeast-2.amazonaws.com/polykey'

# Authenticates skopeo
aws ecr get-login-password \
| skopeo login \
--username AWS \
--password-stdin \
"$registry_image"

build="$(nix-build ./release.nix --attr docker)"
# This will push both the default image tag and the latest tag
./scripts/deploy-image.sh "$build" "$tag" "$registry_image"
```

#### Using docker

```sh
tag='manual'
registry_image='015248367786.dkr.ecr.ap-southeast-2.amazonaws.com/polykey'

aws ecr get-login-password \
| docker login \
--username AWS \
--password-stdin \
"$registry_image"

build="$(nix-build ./release.nix --attr docker)"
loaded="$(docker load --input "$build")"
image_name="$(cut -d':' -f2 <<< "$loaded" | tr -d ' ')"
default_tag="$(cut -d':' -f3 <<< "$loaded")"

docker tag "${image_name}:${default_tag}" "${registry_image}:${default_tag}"
docker tag "${image_name}:${default_tag}" "${registry_image}:${tag}"
docker tag "${image_name}:${default_tag}" "${registry_image}:latest"

docker push "${registry_image}:${default_tag}"
docker push "${registry_image}:${tag}"
docker push "${registry_image}:latest"
```
57 changes: 0 additions & 57 deletions default.nix

This file was deleted.

Loading

0 comments on commit 3d16e2b

Please sign in to comment.