Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions updater/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,45 @@
# Updater Bot
# Updater Bot <img src='https://veekun.com/dex/media/pokemon/global-link/137.png' height=50px/>

[![Docker Repository on Quay](https://quay.io/repository/pokeapi/updater/status "Docker Repository on Quay")](https://quay.io/repository/pokeapi/updater)

## Usage

First, make sure you can read/write the target repository over SSH.
Launch the bot with a volume containing the SSH keys to `/root/.ssh` and an environment variable for email address.
Since this container runs Docker within itself, it needs to run in privileged mode.
Since this container runs [Docker](https://hub.docker.com/_/docker) within itself, it needs to run in privileged mode.

```
```sh
docker run --privileged -v ~/.ssh:/root/.ssh -e COMMIT_EMAIL=example@example.com quay.io/pokeapi/updater
```

Check the log for failed clones; sometimes Magikarp times out.

**Note:** Due to lack of support for file permissions, this does not work on Docker for Windows.
Check the log for failed clones, sometimes <img src="https://veekun.com/dex/media/pokemon/global-link/129.png" alt="Magikarp" height="20"/> times out.

## Environment Variables

### Required

- `COMMIT_EMAIL`
- `COMMIT_EMAIL`

### Optional

See [the Dockerfile](updater/Dockerfile) for the defaults.

- `COMMIT_NAME`
- `COMMIT_MESSAGE`
- `BRANCH_NAME`
- `REPO_POKEAPI`
- `REPO_DATA`
- `COMMIT_NAME`
- `COMMIT_MESSAGE`
- `BRANCH_NAME`
- `REPO_POKEAPI`
- `REPO_DATA`

## Build Docker image

```sh
docker build -t pokeapi-updater .
```

## Run on Windows

Your public/private keys with `KeyName` name will be shared with the pokeapi-updater container. Be sure those keys are the ones with write access on https://github.com/PokeAPI/pokeapi

```pwsh
pwsh Run-Updater.ps1 -KeyName id_rsa -CommitterEmail example@example.com
```
22 changes: 22 additions & 0 deletions updater/Run-Updater.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env pwsh

param (
[string]$KeyName = "id_rsa",
[Parameter(Mandatory=$true)][string]$CommitterEmail
)

docker run -itd --rm --name pokeapi-api-data-updater --privileged -e COMMIT_EMAIL=${CommitterEmail} pokeapi-updater bash

docker exec pokeapi-api-data-updater mkdir -p /root/.ssh/

docker cp ${HOME}/.ssh/${KeyName} pokeapi-api-data-updater:/root/.ssh/id_rsa
docker cp ${HOME}/.ssh/${KeyName}.pub pokeapi-api-data-updater:/root/.ssh/id_rsa.pub
docker cp ${HOME}/.ssh/known_hosts pokeapi-api-data-updater:/root/.ssh/known_hosts

docker exec pokeapi-api-data-updater chmod 600 /root/.ssh/id_rsa
docker exec pokeapi-api-data-updater chmod 644 /root/.ssh/id_rsa.pub
docker exec pokeapi-api-data-updater chmod 644 /root/.ssh/known_hosts

docker exec pokeapi-api-data-updater bash cmd.bash

docker stop pokeapi-api-data-updater