3ムスケティアーズ
どこからでも同じ方法でアプリをテスト、ビルド、デプロイ!
[![ビルドステータス][linkGitHubActionsProjectBadge]][linkGitHubActionsProject] [![ライセンス][linkLicenseBadge]][linkLicense]
目次
- 概要
- 3ムスケティアーズのウェブサイト
- 前提条件
- 開発
- デプロイ
- 0. CloudflareアカウントIDとAPIトークン
- 1. Envファイル
- 2. 作成
- 3. デプロイ
- 4. 削除
- CI/CD
- ビジュアル要素
- 貢献
- ライセンス
概要
3ムスケティアは、ソフトウェアを繰り返しかつ一貫して開発するためのパターンです。 Makeをオーケストレーションツールとして活用し、DockerおよびDocker Composeを使用してアプリケーションのテスト、ビルド、実行、デプロイを行います。 各アプリケーションのMakeおよびDocker/Composeコマンドはアプリケーションのソースコードの一部として管理されており、ローカルまたはCI/CDサーバーで実行する場合でも同じ方法で呼び出されます。
[!NOTE]
詳細については、[公式ウェブサイト][link3Musketeers]をご覧ください。
3ムスケティアのウェブサイト
このリポジトリは、[Astro Starlight][linkAstroStarlight]で構築された[3ムスケティアのウェブサイト][link3Musketeers]です。 このセクションでは、3ムスケティアの手法を用いた開発、テスト、デプロイ方法について説明します。
前提条件
開発
# Create a .env file
make envfile ENVFILE=env.example
Install dependencies
make deps copyDepsToHostFormat and check
make fmt checkStart Astro server for local development
make dev
Wait till the message 'dev-1 | 20:13:41 watching for file changes...' appears
Access the website in your browser at http://127.0.0.1:4321/
\ to stop
Build static site
make buildServe static site for local development
make previewDev
Access the website in your browser at http://127.0.0.1:4321/
\ to stop
Serve static website in the background
make previewTest static website
make testPreviewClean
make clean
デプロイメント
3ムスケティアーズのウェブサイトは[Cloudflare Pages][linkCloudflarePages]にデプロイされています。 このセクションでは、[Wrangler CLI][linkCloudflareWranglerCLI]を使用してPagesプロジェクトを作成、デプロイ、削除する方法を示します。 これは新しい変更をプレビューするのに便利です。
ビルド、テスト、デプロイはGitHub Actionsで行われるため、 このセクションでは[Direct Upload][linkCloudflareDirectUpload]と [Run Wrangler in CI/CD][linkCloudflareWranglerCICD]の指示に従います。
[!NOTE]
このセクションでは静的サイトが
make buildで生成されている必要があります#### 0. CloudflareアカウントIDとAPIトークン
Wrangler CLIを使用してCloudflare Pagesとやり取りするには、CloudflareアカウントIDと APIトークンが必要です。
- アカウントID: [アカウントとゾーンIDの確認][linkCloudflareFindAccountAndZoneIDs]
- APIトークン
- [APIトークンの作成][linkCloudflareCreateAPIToken]
Edit Cloudflare Workersテンプレートを使用Token nameを更新- 権限:
- アカウント - Cloudflare Pages - 編集
- 他の権限は削除
- ご自身のアカウントを含める
- 短期間のTTLを設定
Continue to summaryをクリック- これらの値は次のセクション
1. Envfileで使用されます
以下のセクションでは.envファイルの値を使用します。正しい値で.envファイルを
(env.templateを基に)作成してください。
例:
# .env
ENV_CLOUDFLARE_BRANCH_NAME=main
ENV_CLOUDFLARE_PROJECT_NAME=random-project-name
ENV_SECRET_CLOUDFLARE_ACCOUNT_ID=id-from-previous-section
ENV_SECRET_CLOUDFLARE_API_TOKEN=token-from-previous-section
検証:make shell
Check the env vars are correctly set
env | grep ENV_
List current projects on CloudFlare
deno task deploy:list
exit
#### 2. 作成このセクションでは新しいPagesプロジェクトを作成します。このステップは
ENV_CLOUDFLARE_PROJECT_NAMEがステップ1. Envfileに記載されていなかった場合のみ必要です。
make shell
Create a new project
deno task deploy:create
The new project and its domain should be listed
deno task deploy:list
Project is empty which should not be hosted
curl -I https://${ENV_CLOUDFLARE_PROJECT_NAME}.pages.dev
#HTTP/2 522
#...
Exit the container
exit#### 3. デプロイ
このセクションでは、既存のCloudflare Pagesプロジェクトにウェブサイトをデプロイします。
make shell
Deploy the files to the project
deno task deploy
Project is no longer empty!
curl -I https://${ENV_CLOUDFLARE_PROJECT_NAME}.pages.dev
#HTTP/2 200
#...
Exit the container
exit注:make deployも使用可能です。
#### 4. 削除
このセクションでは、Cloudflare Pagesプロジェクトの削除方法を示します。
make shell
deno task deploy:delete
#? Are you sure you want to delete ""? This action cannot be undone. › y
Check the project is no longer listed
deno task deploy:list
exit [!重要]
セクション
0. CloudflareアカウントIDとAPIトークンで作成したCloudFlareトークンは削除可能ですCI/CD
[GitHub Actions][linkGitHubActions] はPRのテストおよび
main ブランチの変更をCloudflare Pagesにデプロイするために使用されています。
- GitHub Actions専用のCloudflare APIトークンが作成されています
- Cloudflare Pagesへのデプロイに必要な環境変数は
- GitHub Actionsのワークフローは3 Musketeersパターンに従っています
ビジュアル要素
- 3 Musketeersロゴ
- 私が[Procreate][linkProcreate]とVectornatorで作成
- 使用した便利なツールは
offset pathとmask objects - 2048px×2048pxのSVG画像
- 画像は
./src/assets/logo/フォルダにあります - ファビコン
- 元画像はロゴのpng形式の書き出し
- [favicon.io][linkFaviconio]のウェブサイトを使用
- 生成されたコンテンツは
./public/favicon_ioにあります - HTMLの
タグをにコピーする手順は
./astro.config.mjsに設定されています
- ソーシャルメディアプレビュー
- Twitter、Facebook、GitHubなどでウェブサイトのプレビューを表示するためのもの
- 新しく1280x640pxのベクター画像を作成し、中央に縮小したロゴを配置
- サイズはGitHubのGeneral設定で推奨されているもの
- [artegence記事][linkArtegenceArticle]によると、異なるソーシャルプラットフォームで機能する理想的な画像は
- 1200x630pxである
- ロゴ(630x630)が中央に配置されている
- png形式を使用(非常に高品質で透過あり)
- jpg形式を使用(高品質で非常に良いサイズ圧縮)
- ソーシャルイメージはリポジトリの一般設定でも設定されています
- Astro Starlight は
セクション内のすべてのタグを設定します - 図表
- [Mermaid][linkMermaid] は図表の生成に使用されています
- すべての図表はディレクトリ diagrams にあります
- [demo][linkDemo] は [charmbracelet/vhs][linkVHS] によって生成されました
貢献
感謝は [contributors][linkContributors] に送ります。
ライセンス
[MIT][linkLicense]
[link3Musketeers]: https://3musketeers.pages.dev [linkArtegenceArticle]: https://artegence.com/blog/social-media-tags-guide-part-2-preparing-a-perfect-image-for-the-ogimage-tag/ [linkAstroStarlight]: https://starlight.astro.build/ [linkCloudflareCreateAPIToken]: https://dash.cloudflare.com/profile/api-tokens [linkCloudflareDirectUpload]: https://developers.cloudflare.com/pages/get-started/direct-upload/ [linkCloudflareFindAccountAndZoneIDs]: https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/ [linkCloudflarePages]: https://pages.cloudflare.com/ [linkCloudflareWranglerCICD]: https://developers.cloudflare.com/workers/wrangler/ci-cd/ [linkCloudflareWranglerCLI]: https://developers.cloudflare.com/workers/wrangler/ [linkCompose]: https://docs.docker.com/compose [linkContributors]: CONTRIBUTORS [linkDemo]: demo [linkDocker]: https://www.docker.com [linkFaviconio]: https://favicon.io [linkGitHubActions]: https://github.com/features/actions [linkGitHubActionsProject]: https://github.com/flemay/3musketeers/actions [linkGitHubActionsProjectBadge]: https://img.shields.io/github/actions/workflow/status/flemay/3musketeers/deploy.yml?style=for-the-badge&logo=github [linkGitHubActionsSecrets]: https://docs.github.com/en/actions/security-guides/encrypted-secrets [linkGitHubActionsVariables]: https://docs.github.com/en/actions/learn-github-actions/variables [linkLicense]: LICENSE [linkLicenseBadge]: https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge [linkMake]: https://www.gnu.org/software/make [linkMermaid]: https://mermaid.js.org/ [linkPatternOverview]: ./docs/guide/assets/diagrams-overview.svg [linkProcreate]: https://procreate.art/ [linkVHS]: https://github.com/charmbracelet/vhs
--- Tranlated By Open Ai Tx | Last indexed: 2026-02-20 ---