keboola / debug-log-uploader
Keboola Debug Log Uploader
v4.0.0
2023-08-24 09:30 UTC
Requires
- php: >=8.1
- aws/aws-sdk-php: ~3.0
- google/cloud-storage: ^1.33
- microsoft/azure-storage-blob: ~1.5
- symfony/filesystem: ^4.0|^5.0|^6.0
Requires (Dev)
README
一个简单的打包程序,用于将日志上传到AWS S3、Azure Blob存储或本地文件系统。
开发
创建Azure资源
使用提供的azure-services.json
创建ARM堆栈
export RESOURCE_GROUP=testing-debug-log-uploader
az group create --name $RESOURCE_GROUP --location "East US"
az deployment group create \
--resource-group $RESOURCE_GROUP \
--name debug-log-uploader \
--template-file ./azure-services.json \
--query "properties.outputs"
转到Azure门户 - 存储帐户 - 访问密钥并复制连接字符串。
创建GCP资源
使用Terraform
cd provisioning/gcp
terraform init
terraform apply
# set name_prefix (ci for github action)
# set UPLOADER_GCS_BUCKET env
# Go to the `https://console.cloud.google.com/iam-admin/serviceaccounts?project=gcp-dev-353411` (or your default project) and find your service account
(`<name_prefix>-debug-log-uploader@...`)
# In the table click on action and choose `Manage keys` (or click on service name and go to the detail and then choose `keys`)
# Click on `ADD KEY` => `Create new key` and select key type `JSON` then click `CREATE`
# convert key to string and save to `.env` file: `awk -v RS= '{$1=$1}1' <key_file>.json >> .env`
# set content on the last line of `.env` as variable `UPLOADER_GCS_BUCKET_KEY`
创建.env文件
从.env.dist
创建.env
文件(包含您的环境变量)
UPLOADER_AWS_KEY=your_key
UPLOADER_AWS_SECRET=your_secret
UPLOADER_AWS_REGION=your_region
UPLOADER_S3_BUCKET=your_s3_bucket
UPLOADER_ABS_CONNECTION_STRING=
UPLOADER_ABS_CONTAINER=
启动容器,安装依赖项
docker-compose run --rm php sh -c 'composer install && bash'
测试
执行包含phpunit
和相关命令的tests.sh
脚本。
在运行容器中
./tests.sh
从外部
docker-compose run --rm php sh -c 'composer install && ./tests.sh'
许可
MIT许可,请参阅LICENSE文件。