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.
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:
- Build the application:
go build -o faynoSync faynoSync.go
- Start the auto updater service with migrations:
Note: To rollback your migrations run:
./faynoSync --migration --rollback
-
Upload your application to S3 and set the version number in faynoSync-dashboard or using API.
-
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.
- 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