Serverless Satis Solution
Solution for hosting private Composer repository without running any servers.
Sample Use Cases
Bellow are provided few sample use cases:
- Hosting private Composer repository with your company's internal packages
- Hosting repository with your commercial packages, which you license to your customers
- Hosting a mirror of public packages, to speed up your builds
How it works
First, you need to generate a Composer repository using s3-satis tool. The repository will be stored in a CloudFlare R2 bucket. Then, Private Satis Repository CloudFlare Worker will serve the repository to the users.
Requirements
- GitHub account:
- repository for configuration files and running GitHub Actions,
- GitHub Personal Access Token with
repo
scope,
- CloudFlare account:
- domain configured and pointing to CloudFlare DNS servers,
- access to CloudFlare Workers,
- CloudFlare R2 Storage bucket,
- CloudFlare KV namespace,
- CloudFlare API Token.
Quick Start
For quick start, you can fork git repo for my composer.duma.dev repository.
GitHub RepositoryIn your forked repository, you need to update following files:
wrangler.toml
- for details see Private Satis Repository CloudFlare Worker documentation,satis.json
- for details see s3-satis documentation.
Then, you need to add following GitHub Secrets in your forked repository:
CLOUDFLARE_ACCOUNT_ID
- ID of your CloudFlare accountCLOUDFLARE_API_TOKEN
- CloudFlare API Token withWorkers R2 Storage:Edit
,Workers KV Storage:Edit
,Workers Scripts:Edit
,Account Settings:Read
,Workers Routes:Edit
,User Details:Read
permissionsCOMPOSER_TOKEN
- GitHub Personal Access Token withrepo
scopeS3_ACCESS_KEY_ID
- R2 access key IDS3_SECRET_ACCESS_KEY
- R2 secret access key
And you need to add following GitHub Variables in your forked repository:
S3_BUCKET
- R2 bucket nameS3_ENDPOINT
- R2 endpointS3_REGION
- R2 region (use defaultus-east-1
if unsure)
After that, you can run actions from your forked repository.
- Go to
Actions
tab in your forked repository, - Select
Deploy CloudFlare Worker
from sidebar, - Click
Run workflow
button, select your branch and clickRun workflow
button. - Select
Publish Satis Repo
from sidebar, - Click
Run workflow
button, select your branch, leave rest of options as is and clickRun workflow
button.
While actions are running, you can go to CloudFlare KV and add your users.
When actions finish successfully, you should be able to access your repository from domain of your choice.