diff options
| -rw-r--r-- | .env.example | 3 | ||||
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | CLAUDE.md | 68 | ||||
| -rwxr-xr-x | official-site/add-event.sh | 47 | ||||
| -rwxr-xr-x | official-site/deploy.sh | 41 | ||||
| -rw-r--r-- | official-site/events/2026-06-27-cre4m-sod4.json | 17 | ||||
| -rwxr-xr-x | official-site/list-events.sh | 25 |
7 files changed, 204 insertions, 0 deletions
diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..dca2f4c --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=ap-northeast-1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4961c5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +node_modules/ +*.local diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..0f8b3aa --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,68 @@ +# mosquitone-admin + +mosquitone バンドの各システムを管理するリポジトリ。 + +## システム構成 + +### 公式サイト (official-site) + +- URL: https://www.mosquit.one +- ホスティング: AWS Amplify (Gatsby) +- App ID: `d33773t2lyrxkx` +- GitHub リポジトリ: https://github.com/mosquitone/official-site-2023-dev +- 本番ブランチ: `main` +- リージョン: `ap-northeast-1` + +#### バックエンド (AppSync) + +- エンドポイント: `https://APP_SYNC_ENDPOINT_REDACTED/graphql` +- API キー: `.env` の `APP_SYNC_API_KEY` 参照(`APP_SYNC_API_KEY_REDACTED`) +- データストア: AWS AppSync + DynamoDB (Amplify DataStore) + +#### 主要 GraphQL 型 + +**Event(ライブ情報)** +| フィールド | 型 | 必須 | 説明 | +|---|---|---|---| +| id | ID | ✓ | UUID | +| type | EventType | ✓ | 現状 `LIVE` のみ | +| date | AWSDate | - | YYYY-MM-DD | +| title | String | ✓ | イベントタイトル | +| venueName | String | - | 会場名 | +| published | Boolean | ✓ | 公開フラグ | +| description | String | ✓ | 出演者など | +| ticketFee | String | - | チケット料金 | +| ticketURL | AWSURL | - | チケット購入 URL | +| detailURL | AWSURL | - | 詳細 URL | +| mainImageURL | AWSURL | - | フライヤー画像 URL | +| shortTitle | String | - | 短いタイトル | +| key | String | - | 識別キー(YYYYMMDD 等) | +| venueURL | AWSURL | - | 会場 URL | + +## よく使うコマンド + +```bash +# .env を読み込む +source .env # または set -a; source .env; set +a + +# ライブ一覧を新しい順に表示 +bash official-site/list-events.sh + +# イベントを追加 +bash official-site/add-event.sh + +# Amplify を手動デプロイ(main ブランチの再ビルド) +bash official-site/deploy.sh +``` + +## AWS 認証 + +`.env` に以下を設定: + +``` +AWS_ACCESS_KEY_ID=... +AWS_SECRET_ACCESS_KEY=... +AWS_DEFAULT_REGION=ap-northeast-1 +``` + +`aws` コマンドは `/tmp/awscli/aws/dist/aws` を使用(システムに AWS CLI がない場合)。 diff --git a/official-site/add-event.sh b/official-site/add-event.sh new file mode 100755 index 0000000..52c2d95 --- /dev/null +++ b/official-site/add-event.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# Usage: bash add-event.sh <json-file> +# The JSON file should match the Event schema (see CLAUDE.md). +# id, createdAt, updatedAt, _version, _deleted, _lastChangedAt are auto-managed. +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +[ -f "$REPO_ROOT/.env" ] && set -a && source "$REPO_ROOT/.env" && set +a + +ENDPOINT="https://APP_SYNC_ENDPOINT_REDACTED/graphql" +API_KEY="${APP_SYNC_API_KEY:-APP_SYNC_API_KEY_REDACTED}" + +JSON_FILE="${1:-}" +if [ -z "$JSON_FILE" ]; then + echo "Usage: $0 <event-json-file>" + exit 1 +fi + +INPUT=$(python3 -c " +import json, sys +with open('$JSON_FILE') as f: + data = json.load(f) +# Remove read-only / auto-managed fields +for k in ['id', 'createdAt', 'updatedAt', '_version', '_deleted', '_lastChangedAt', '_note']: + data.pop(k, None) +# Remove null fields (optional) +data = {k: v for k, v in data.items() if v is not None} +print(json.dumps(data)) +") + +QUERY='mutation CreateEvent($input: CreateEventInput!) { createEvent(input: $input) { id type date title venueName published } }' +PAYLOAD=$(python3 -c " +import json, sys +q = '$QUERY' +inp = $INPUT +print(json.dumps({'query': q, 'variables': {'input': inp}})) +") + +echo "Creating event from $JSON_FILE ..." +RESULT=$(curl -s -X POST "$ENDPOINT" \ + -H "Content-Type: application/json" \ + -H "x-api-key: $API_KEY" \ + -d "$PAYLOAD") + +echo "$RESULT" | python3 -m json.tool +echo "" +echo "Done. Run 'bash deploy.sh' to rebuild the site." diff --git a/official-site/deploy.sh b/official-site/deploy.sh new file mode 100755 index 0000000..32574e0 --- /dev/null +++ b/official-site/deploy.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +[ -f "$REPO_ROOT/.env" ] && set -a && source "$REPO_ROOT/.env" && set +a + +AWS_CLI="${AWS_CLI:-/tmp/awscli/aws/dist/aws}" +APP_ID="d33773t2lyrxkx" +BRANCH="main" +REGION="${AWS_DEFAULT_REGION:-ap-northeast-1}" + +echo "Starting Amplify build: app=$APP_ID branch=$BRANCH" +JOB=$("$AWS_CLI" amplify start-job \ + --app-id "$APP_ID" \ + --branch-name "$BRANCH" \ + --job-type RELEASE \ + --region "$REGION" \ + --output json) + +JOB_ID=$(echo "$JOB" | python3 -c "import json,sys; print(json.load(sys.stdin)['jobSummary']['jobId'])") +echo "Job started: $JOB_ID" +echo "Console: https://ap-northeast-1.console.aws.amazon.com/amplify/apps/$APP_ID/branches/$BRANCH/deployments/$JOB_ID" + +echo "Waiting for build to complete..." +while true; do + STATUS=$("$AWS_CLI" amplify get-job \ + --app-id "$APP_ID" \ + --branch-name "$BRANCH" \ + --job-id "$JOB_ID" \ + --region "$REGION" \ + --output json | python3 -c "import json,sys; print(json.load(sys.stdin)['job']['summary']['status'])") + echo " Status: $STATUS" + if [[ "$STATUS" == "SUCCEED" ]]; then + echo "Build succeeded! https://www.mosquit.one" + break + elif [[ "$STATUS" == "FAILED" || "$STATUS" == "CANCELLED" ]]; then + echo "Build $STATUS" + exit 1 + fi + sleep 15 +done diff --git a/official-site/events/2026-06-27-cre4m-sod4.json b/official-site/events/2026-06-27-cre4m-sod4.json new file mode 100644 index 0000000..89ce98a --- /dev/null +++ b/official-site/events/2026-06-27-cre4m-sod4.json @@ -0,0 +1,17 @@ +{ + "id": "4c99e242-c13d-404b-92a9-4c2cd59ad68a", + "type": "LIVE", + "date": "2026-06-27", + "title": "cre4m sod4", + "shortTitle": "cre4m sod4", + "venueName": "navey floor AKASAKA", + "published": true, + "description": "雨傘とペトリコール / mosquitone / 人造ネオン / LOOM", + "ticketFee": "一般 ¥3,000(+1D ¥700) ※学生証提示で¥1,000ディスカウント / 配信 ¥2,000", + "key": "260627", + "ticketURL": null, + "detailURL": null, + "mainImageURL": null, + "venueURL": null, + "_note": "OPEN 18:30 / START 19:00" +} diff --git a/official-site/list-events.sh b/official-site/list-events.sh new file mode 100755 index 0000000..0093875 --- /dev/null +++ b/official-site/list-events.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +[ -f "$REPO_ROOT/.env" ] && set -a && source "$REPO_ROOT/.env" && set +a + +AWS_CLI="${AWS_CLI:-/tmp/awscli/aws/dist/aws}" +ENDPOINT="https://APP_SYNC_ENDPOINT_REDACTED/graphql" +API_KEY="${APP_SYNC_API_KEY:-APP_SYNC_API_KEY_REDACTED}" + +QUERY='{ listEvents(limit: 200) { items { id type date title venueName published shortTitle ticketFee key } } }' + +curl -s -X POST "$ENDPOINT" \ + -H "Content-Type: application/json" \ + -H "x-api-key: $API_KEY" \ + -d "{\"query\": $(echo "$QUERY" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')}" \ +| python3 -c " +import json, sys +d = json.load(sys.stdin) +items = d['data']['listEvents']['items'] +items.sort(key=lambda x: x['date'] or '') +for e in items: + pub = '✓' if e['published'] else ' ' + print(f\"[{pub}] {e['date']} {e['title'][:50]:<50} {e['venueName'] or ''}\") +" |
