https://github.com/ehsannarmani/gradle-mirror-cloudflare-worker
A mirror that has been developed to download gradle dependencies without network interference and sanctions
https://github.com/ehsannarmani/gradle-mirror-cloudflare-worker
android android-dependency android-studio dependency-mirror gradle gradle-dependency gradle-mirror mirror mirrored-repository
Last synced: about 1 year ago
JSON representation
A mirror that has been developed to download gradle dependencies without network interference and sanctions
- Host: GitHub
- URL: https://github.com/ehsannarmani/gradle-mirror-cloudflare-worker
- Owner: ehsannarmani
- Created: 2024-12-23T21:28:04.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-02T09:25:27.000Z (over 1 year ago)
- Last Synced: 2025-03-25T11:04:15.872Z (about 1 year ago)
- Topics: android, android-dependency, android-studio, dependency-mirror, gradle, gradle-dependency, gradle-mirror, mirror, mirrored-repository
- Language: Shell
- Homepage: https://en-mirror.ir
- Size: 15.6 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Gradle Mirror By Cloudflare Workers
#### This mirror developed to download gradle dependencies without network interference and sanctions
### Usage:
Simply add the mirror url as a maven repository in the `settings.gradle` file and re-sync project:
```kotlin
pluginManagement {
repositories {
maven("https://en-mirror.ir")
}
}
dependencyResolutionManagement {
...
repositories {
maven("https://en-mirror.ir")
}
}
```
> [!NOTE]
> Clone of mirror is launched at `en-mirror.ir` and ready to use. this mirror contains `google`,`central` and `jitpack` mavens.
### Repository Filtering
By default, all repositories are mirrored. To mirror only a specific repository, include its key in the mirror URL, like this:
```kotlin
maven("https://en-mirror.ir/jitpack")
```
### Worker Setup:
- Manual Setup:
- Login to cloudflare
- Click on workers & pages tab
- Create new worker with optional name and click on deploy
- In the new tab, click on edit code
- Copy & Paste worker.js codes into opened tab and click on deploy button
- CLI Setup:
- Ensure you have Node.js installed on your system, then install the Wrangler CLI:
- `npm install -g wrangler`
- Login to your cloudflare account using: `wrangler login`
- Update configuration in wrangler.toml:
- Set `compatibility_date` field to current date
- Deploy the worker using: `wrangler deploy`
- Bash Setup:
- Ensure you have Node.js installed on your system
- Execute the bash script:
- `bash <(curl -fsSL https://raw.githubusercontent.com/ehsannarmani/gradle-mirror-cloudflare-worker/master/setup.sh)`
- Note: if you are in Windows os, you can execute the bash script like this:
- `bash -c "bash <(curl -fsSL https://raw.githubusercontent.com/ehsannarmani/gradle-mirror-cloudflare-worker/master/setup.sh)"`
#### Now, your worker is ready to use and the mirror url is your worker url in this pattern: `https://[worker-name].[cloudflare-username].workers.dev/`
### Custom Domain:
- Set up your domain in Cloudflare, configure the DNS servers on the domain, and wait until the domain becomes active
- After your domain becomes active, click on websites tab and select your domain
- Click on DNS tab and add new `CNAME` record, set content to your worker domain: `[worker-name].[cloudflare-username].workers.dev`
- Keep proxied checked
- Click on Worker Routes tab and add route
- If you want to mirror your root domain, enter the route like this: `https://your-domain.com/*`
- Select the created worker and click on save.
#### Now your custom domain should be connected to worker, and you can use your own mirror!
> [!NOTE]
> You can set up mirror without using cloudflare with PHP Back-End, [see](https://github.com/ehsannarmani/gradle-mirror-php).