Show HN:FaynoSync 自托管API,实现应用自动更新
Show HN: FaynoSync Self-Hosted API for Automatic App Updates

原始链接: https://github.com/ku9nov/faynoSync

faynoSync是一个开源的API服务器,用于实现客户端应用程序的自动化更新。它使用S3存储应用程序版本,并提供API端点供客户端检查更新。客户端将当前版本与API的最新版本进行比较,如果可用更新,则提供下载链接。 该服务器支持Minio和AWS S3,可通过环境变量进行配置(包括存储凭据、存储桶名称和API密钥)。它还集成了MongoDB用于数据持久化,以及Redis用于性能优化。 主要功能包括: * 版本检查与更新分发。 * 灵活的更新方式(后台/按需)。 * 具有身份验证和授权功能的全面API。 * 团队用户管理,并具有访问权限控制。 * 支持多个平台和架构。 * 使用预定义测试用例进行端到端测试。 设置过程包括克隆存储库、配置环境变量以及使用Docker Compose运行应用程序。客户端示例和Postman模板可方便集成。详细文档在存储库和在线提供。

Hacker News new | past | comments | ask | show | jobs | submit login Show HN: FaynoSync Self-Hosted API for Automatic App Updates (github.com/ku9nov) 8 points by ku9n 18 hours ago | hide | past | favorite | discuss faynoSync is a lightweight, open-source API server that gives you full control over application updates. Whether it’s desktop software, mobile apps, browser extensions, or custom binaries for metrics or monitoring — faynoSync helps you deliver updates easily, securely, and reliably. No external dependencies. Just pure control. Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4 Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact Search:
相关文章

原文

a-github-banner-for-faynosync-featuring

This application is a simple API server for automatically updating client applications. It allows you to upload your application to S3 and set the version number. The client application can then check the version number against the auto updater service API. If the service has a newer version, it will return a link to the updated service, and the client application will show an alert.

The API server is designed for straightforward and intuitive application management. It supports updating client applications both in the background and on-demand, depending on how it's implemented in the client application. This provides flexibility in choosing the update method that best suits your needs.

The documentation is available in this repository faynoSync-site and at this link faynoSync Documentation.

The repository with the available frontend is available in this repository faynoSync-dashboard.

Client Application Examples

You can find examples of client applications here.

You can find the Postman template here, or you can check available API requests here.

To use this application, you will need to have Golang installed on your machine. You can install it from the official website.

Once you have installed Golang, clone this repository to your local machine:

git clone https://github.com/ku9nov/faynoSync.git

To configure the faynoSync, you will need to set the following environment variables:

STORAGE_DRIVER (`minio` or `aws`)
S3_ACCESS_KEY (Your AWS or Minio access key ID.)
S3_SECRET_KEY (Your AWS or Minio secret access key.)
S3_REGION (The AWS region in which your S3 bucket is located. For Minio this value should be empty.)
S3_BUCKET_NAME (The name of your S3 bucket.)
S3_ENDPOINT (s3 endpoint, check documentation of your cloud provider)
S3_BUCKET_NAME_PUBLIC (The name of your public S3 bucket. Artifacts will be uploaded here by default.)
S3_ENDPOINT_PUBLIC (The public bucket endpoint for S3. Check the documentation of your cloud provider. Artifacts will be uploaded here by default.)
ALLOWED_CORS ( urls to allow CORS configuration)
PORT (The port on which the auto updater service will listen. Default: 9000)
MONGODB_URL=mongodb://root:[email protected]/cb_faynosync_db?authSource=admin (see docker-compose file)
API_KEY (generated by 'openssl rand -base64 16') Used for SignUp
API_URL=(public URL to this API)
PERFORMANCE_MODE (Set to `true` to enable performance mode)
REDIS_HOST (The hostname for the Redis server, default: `localhost`)
REDIS_PORT (The port for the Redis server, default: `6379`)
REDIS_PASSWORD (Password for Redis, leave empty if not set)
REDIS_DB (The Redis database number to use, default: `0`)
ENABLE_PRIVATE_APP_DOWNLOADING=false (if enabled, then apps located in private S3 can be downloaded using the public API; if disabled, then download links require authentication)
ENABLE_TELEMETRY (Set to `true` to enable telemetry)

You can set these environment variables in a .env file in the root directory of the application. You can use the .env.local file, which contains all filled variables.

To build and run the API with all dependencies, you can use the following command:

docker-compose up --build

You can now run tests using this command (please wait until the s3-service successfully creates the bucket):

docker exec -it faynoSync_backend "/usr/bin/faynoSync_tests"

If you only want to run dependency services (for local development without Docker), use this command:

docker-compose -f docker-compose.yaml -f docker-compose.development.yaml up

To use the auto updater service, follow these steps:

  1. Build the application:
go build -o faynoSync faynoSync.go
  1. Start the auto updater service with migrations:

Note: To rollback your migrations run:

./faynoSync --migration --rollback
  1. Upload your application to S3 and set the version number in faynoSync-dashboard or using API.

  2. In your client application, make a GET request to the auto updater service API, passing the current version number as a query parameter:

http://localhost:9000/checkVersion?app_name=myapp&version=0.0.1&owner=admin

The auto updater service will return a JSON response with the following structure:

{
    "update_available": false,
    "update_url_deb": "http://localhost:9000/download?key=secondapp/myapp-0.0.1.deb",
    "update_url_rpm": "http://localhost:9000/download?key=secondapp/myapp-0.0.1.rpm"
}

If an update is available, the update_available field will be true, and the update_url field will contain a link to the updated application.

  1. In your client application, show an alert to the user indicating that an update is available and provide a link to download the updated application.

Run e2e tests:

Build test binary file:

go test -c -o faynoSync_tests

Test Descriptions

To successfully run the tests and have them pass, you need to populate the .env file.

The tests verify the implemented API using a test database and an existing S3 bucket.

List of Tests
  • TestHealthCheck
  • TestLogin
  • TestFailedLogin (expected result from API "401")
  • TestListApps
  • TestListAppsWithInvalidToken (expected result from API "401")
  • TestAppCreate
  • TestSecondaryAppCreate (expected result from API "failed")
  • TestUploadApp
  • TestUploadDuplicateApp (expected result from API "failed")
  • TestDeleteApp
  • TestChannelCreateNightly
  • TestChannelCreateStable
  • TestUploadAppWithoutChannel (expected result from API "failed")
  • TestMultipleUploadWithChannels
  • TestSearchApp
  • TestCheckVersionLatestVersion
  • TestFetchkLatestVersionOfApp
  • TestMultipleDelete
  • TestDeleteNightlyChannel
  • TestDeleteStableChannel
  • TestPlatformCreate
  • TestUploadAppWithoutPlatform
  • TestArchCreate
  • TestUploadAppWithoutArch
  • TestDeletePlatform
  • TestDeleteArch
  • TestListArchs
  • TestListPlatforms
  • TestListChannels
  • TestListArchsWhenExist
  • TestListPlatformsWhenExist
  • TestListChannelsWhenExist
  • TestSignUp
  • TestFailedSignUp (expected result from API "401")
  • TestUpdateSpecificApp
  • TestListAppsWhenExist
  • TestDeleteAppMeta
  • TestUpdateChannel
  • TestUpdateApp
  • TestUpdatePlatform
  • TestUpdateArch
  • TestFailedUpdatePlatform (expected result from API "400")
  • TestChannelCreateWithWrongName (expected result from API "400")
  • TestCreateSecondPlatform
  • TestCreateSecondArch
  • TestMultipleUploadWithSameExtension
  • TestCheckVersionWithSameExtensionArtifactsAndDiffPlatformsArchs
  • TestMultipleDeleteWithSameExtensionArtifactsAndDiffPlatformsArchs
  • TestDeleteSecondPlatform
  • TestDeleteSecondArch
  • TestCreatePublicApp
  • TestDeletePublicAppMeta
  • TestUpdateSpecificAppWithSecondUser (expected result from API "500")
  • TestListAppsWithSecondUser
  • TestListChannelsWithSecondUser
  • TestListPlatformsWithSecondUser
  • TestListArchsWithSecondUser
  • TestUpdateAppWithSecondUser (expected result from API "500")
  • TestUpdateChannelWithSecondUser (expected result from API "500")
  • TestUpdatePlatformWithSecondUser (expected result from API "500")
  • TestUpdateArchWithSecondUser (expected result from API "500")
  • TestMultipleDeleteWithSameExtensionArtifactsAndDiffPlatformsArchsWithSecondUser (expected result from API "500")
  • TestDeleteNightlyChannelWithSecondUser (expected result from API "500")
  • TestDeletePlatformWithSecondUser (expected result from API "500")
  • TestDeleteArchWithSecondUser (expected result from API "500")
  • TestDeleteAppMetaWithSecondUser (expected result from API "500")
  • TestCreateTeamUser
  • TestTeamUserLogin
  • TestFailedUploadAppUsingTeamUser (expected result from API "403")
  • TestFailedUpdateAppUsingTeamUser (expected result from API "403")
  • TestFailedUpdateChannelUsingTeamUser (expected result from API "403")
  • TestFailedUpdatePlatformUsingTeamUser (expected result from API "403")
  • TestFailedUpdateArchUsingTeamUser (expected result from API "403")
  • TestListAppsUsingTeamUserBeforeCreate
  • TestListChannelsUsingTeamUserBeforeCreate
  • TestListPlatformsUsingTeamUserBeforeCreate
  • TestListArchsUsingTeamUserBeforeCreate
  • TestAppCreateTeamUser
  • TestListAppsUsingTeamUser
  • TestFailedDeleteTeamUserApp (expected result from API "403")
  • TestChannelCreateTeamUser
  • TestListChannelsUsingTeamUser
  • TestFailedDeleteTeamUserChannel (expected result from API "403")
  • TestPlatformCreateTeamUser
  • TestListPlatformsUsingTeamUser
  • TestFailedDeleteTeamUserPlatform (expected result from API "403")
  • TestArchCreateTeamUser
  • TestListArchsUsingTeamUser
  • TestFailedDeleteTeamUserArch (expected result from API "403")
  • TestFailedUpdateTeamUser (expected result from API "403")
  • TestUpdateTeamUser
  • TestUpdateAppUsingTeamUser
  • TestUpdateChannelUsingTeamUser
  • TestUpdatePlatformUsingTeamUser
  • TestUpdateArchUsingTeamUser
  • TestFailedAppCreateTeamUser (expected result from API "403")
  • TestDeleteTeamUserApp
  • TestDeleteTeamUserChannel
  • TestDeleteTeamUserPlatform
  • TestDeleteTeamUserArch
  • TestListTeamUsers
  • TestDeleteTeamUser
  • TestWhoAmIAdmin
  • TestWhoAmITeamUser
  • TestFailedUpdateAdminUser
  • TestUpdateAdminUser
  • TestFailedLoginWithOldPassword
  • TestSuccessfulLoginWithNewPassword
  • TestFailedUpdateAdminUserUsingTeamUser
  • TestFilterSearchWithChannel
  • TestFilterSearchWithChannelAndPublished
  • TestFilterSearchWithChannelAndPublishedAndCritical
  • TestFilterSearchWithChannelAndPublishedAndCriticalAndPlatform
  • TestFilterSearchWithChannelAndPublishedAndCriticalAndPlatformAndArch
  • TestSearchOnlyPublished
  • TestSearchOnlyCritical
  • TestSearchOnlyUniversalPlatform
  • TestMultipleUploadWithIntermediate
  • TestUpdateSpecificAppWithIntermediate
  • TestCheckVersionWithIntermediate
  • TestMultipleDeleteWithIntermediate
  • TestTelemetryWithVariousParams

Install migrate tool here.

cd mongod/migrations
migrate create -ext json name_of_migration

Then run the migrations again.

This application is licensed under the Apache license. See the LICENSE file for more details

联系我们 contact @ memedata.com