├── .github ├── scripts │ ├── build_daprbundle.py │ └── get_release_version.py └── workflows │ └── release.yaml ├── .gitignore ├── CODEOWNERS ├── LICENSE ├── README.md └── requirements.txt /.github/scripts/build_daprbundle.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------ 2 | # Copyright 2021 The Dapr Authors 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # ------------------------------------------------------------ 13 | 14 | 15 | import argparse 16 | from errno import ESTALE 17 | from fileinput import filename 18 | from http.client import OK 19 | import subprocess 20 | import tarfile 21 | import zipfile 22 | import requests 23 | import json 24 | import os 25 | import sys 26 | import shutil 27 | import semver 28 | import stat 29 | 30 | 31 | # GitHub Organization and repo name to download release 32 | GITHUB_ORG="dapr" 33 | GITHUB_DAPR_REPO="dapr" 34 | GITHUB_DASHBOARD_REPO="dashboard" 35 | GITHUB_CLI_REPO="cli" 36 | 37 | # Dapr binaries filename 38 | DAPRD_FILENAME="daprd" 39 | PLACEMENT_FILENAME="placement" 40 | SENTRY_FILENAME="sentry" 41 | DASHBOARD_FILENAME="dashboard" 42 | CLI_FILENAME="dapr" 43 | SCHEDULER_FILENAME="scheduler" 44 | DAPRBUNDLE_FILENAME="daprbundle" 45 | 46 | BIN_DIR="dist" 47 | IMAGE_DIR="docker" 48 | BUNDLE_DIR="daprbundle" 49 | ARCHIVE_DIR="archive" 50 | 51 | DAPR_IMAGE="daprio/dapr" 52 | detailsFileName="details.json" 53 | 54 | 55 | global runtime_os,runtime_arch,runtime_ver,dashboard_ver,cli_ver,added_files 56 | 57 | 58 | # Returns latest release/pre-release version of the given repo from GitHub (e.g. `dapr`) 59 | def getLatestRelease(repo): 60 | preRelease = os.getenv("PRERELEASE") 61 | daprReleaseUrl = "https://api.github.com/repos/" + GITHUB_ORG + "/" + repo + "/releases" 62 | print(daprReleaseUrl) 63 | resp = requests.get(daprReleaseUrl) 64 | if resp.status_code != requests.codes.ok: 65 | print(f"Error pulling latest release of {repo}") 66 | resp.raise_for_status() 67 | sys.exit(1) 68 | data = json.loads(resp.text) 69 | versions = [] 70 | for release in data: 71 | if not release["draft"] and not release["prerelease"]: 72 | versions.append(release["tag_name"].lstrip("v")) 73 | if preRelease == "true" and release["prerelease"]: 74 | versions.append(release["tag_name"].lstrip("v")) 75 | if len(versions) == 0: 76 | print(f"No releases found for {repo}") 77 | sys.exit(1) 78 | latest_release = versions[0] 79 | for version in versions: 80 | if semver.compare(version,latest_release) > 0: 81 | latest_release = version 82 | return latest_release 83 | 84 | # Returns the complete filename of the archived binary(e.g. `daprd_linux_amd64.tar.gz`) 85 | def binaryFileName(fileBase): 86 | if(runtime_os == "windows"): 87 | ext = "zip" 88 | else: 89 | ext = "tar.gz" 90 | fileName = f"{fileBase}_{runtime_os}_{runtime_arch}.{ext}" 91 | return fileName 92 | 93 | # Creates archive file of the binary in `src` folder and places it in `dest` folder 94 | def make_archive(src,dest,fileBase): 95 | print(f"Archiving {src} to {os.path.join(dest,binaryFileName(fileBase))}") 96 | fileNameBase = f"{fileBase}_{runtime_os}_{runtime_arch}" 97 | filePathBase = os.path.join(dest,fileNameBase) 98 | if runtime_os == "windows": 99 | shutil.make_archive(filePathBase,"zip",".",src) 100 | else: 101 | shutil.make_archive(filePathBase,"gztar",".",src) 102 | 103 | # Extracts the given archived file in `dir` folder 104 | def unpack_archive(filePath,dir): 105 | print(f"Extracting {filePath} to {dir}") 106 | if filePath.endswith('.zip'): 107 | shutil.unpack_archive(filePath,dir,"zip") 108 | else: 109 | if filePath.endswith('.tar.gz'): 110 | shutil.unpack_archive(filePath,dir,"gztar") 111 | else: 112 | print(f"Unknown archive file {filePath}") 113 | sys.exit(1) 114 | 115 | # Downloads the given dapr binary(e.g. `daprd`) from the github `repo` and places it in `out_dir` folder 116 | def downloadBinary(repo, fileBase, version, out_dir): 117 | fileName = binaryFileName(fileBase) 118 | url = f"https://github.com/{GITHUB_ORG}/{repo}/releases/download/v{version}/{fileName}" 119 | downloadPath = os.path.join(out_dir,fileName) 120 | 121 | if not os.path.exists(out_dir): 122 | os.makedirs(out_dir) 123 | 124 | print(f"Downloading {url} to {downloadPath}") 125 | 126 | resp = requests.get(url,stream=True) 127 | if resp.status_code == 200: 128 | with open(downloadPath, 'wb') as f: 129 | f.write(resp.raw.read()) 130 | else: 131 | print(f"Error: Unable to Download {url}") 132 | 133 | print(f"Downloaded {url} to {downloadPath}") 134 | 135 | # Downloads all required dapr binaries (`daprd`,`placement`,`dashboard`) in `BIN_DIR` subfolder and dapr cli (`dapr`) in `dir` folder 136 | def downloadBinaries(dir): 137 | bin_dir = os.path.join(dir,BIN_DIR) 138 | downloadBinary(GITHUB_DAPR_REPO,DAPRD_FILENAME,runtime_ver,bin_dir) 139 | downloadBinary(GITHUB_DAPR_REPO,PLACEMENT_FILENAME,runtime_ver,bin_dir) 140 | downloadBinary(GITHUB_DAPR_REPO,SENTRY_FILENAME,runtime_ver,bin_dir) 141 | downloadBinary(GITHUB_DAPR_REPO,SCHEDULER_FILENAME,runtime_ver,bin_dir) 142 | downloadBinary(GITHUB_DASHBOARD_REPO,DASHBOARD_FILENAME,dashboard_ver,bin_dir) 143 | downloadBinary(GITHUB_CLI_REPO,CLI_FILENAME,cli_ver,dir) 144 | 145 | cli_filepath = os.path.join(dir,binaryFileName(CLI_FILENAME)) 146 | unpack_archive(cli_filepath,dir) 147 | os.remove(cli_filepath) 148 | 149 | # Returns the fileName of the docker image to be saved. 150 | # E.g., for image `daprio/dapr:1.7.0`, the fileName would be `daprio-dapr-1.7.0.tar.gz` 151 | def getFileName(image): 152 | fileName = image.replace("/","-").replace(":","-") + ".tar.gz" 153 | return fileName 154 | 155 | # Downloads the givern version of docker image and saves it in `out_dir` folder 156 | def downloadDockerImage(image_name, version, out_dir): 157 | docker_image=f"{image_name}:{version}" 158 | if (version == "latest"): 159 | docker_image =image_name 160 | fileName = getFileName(docker_image) 161 | downloadPath = os.path.join(out_dir,fileName) 162 | 163 | if not os.path.exists(out_dir): 164 | os.makedirs(out_dir) 165 | 166 | print(f"Downloading {docker_image} to {downloadPath}") 167 | 168 | cmd = ["docker", "pull",docker_image] 169 | completed_process = subprocess.run(cmd,text=True) 170 | if(completed_process.returncode != 0): 171 | print(f"Error pulling docker image {docker_image}") 172 | sys.exit(1) 173 | 174 | cmd = ["docker", "save", "-o", downloadPath, docker_image] 175 | completed_process = subprocess.run(cmd,text=True) 176 | if(completed_process.returncode != 0): 177 | print(f"Error saving docker image {docker_image}") 178 | sys.exit(1) 179 | 180 | print(f"Downloaded {docker_image} to {downloadPath}") 181 | 182 | # Downloads all required docker images and saves it in `IMAGE_DIR` subfolder of `dir` 183 | def downloadDockerImages(dir): 184 | image_dir = os.path.join(dir,IMAGE_DIR) 185 | downloadDockerImage(DAPR_IMAGE,runtime_ver,image_dir) 186 | 187 | # Parses command line arguments 188 | def parseArguments(): 189 | global runtime_os,runtime_arch,runtime_ver,dashboard_ver,cli_ver,ARCHIVE_DIR,added_files 190 | all_args = argparse.ArgumentParser() 191 | all_args.add_argument("--runtime_os",required=True,help="Runtime OS: [windows/linux/darwin]") 192 | all_args.add_argument("--runtime_arch",required=True,help="Runtime Architecture: [amd64/arm/arm64]") 193 | all_args.add_argument("--runtime_ver",default="latest",help="Dapr Runtime Version: default=latest e.g. 1.6.0") 194 | all_args.add_argument("--dashboard_ver",default="latest",help="Dapr Dashboard Version: default=latest e.g. 0.9.0") 195 | all_args.add_argument("--cli_ver",default="latest",help="Dapr CLI Version: default=latest e.g. 1.6.0") 196 | all_args.add_argument("--archive_dir",default="archive",help="Output Archive directory: default=archive") 197 | all_args.add_argument("--added_files",default="",help="Extra files to be included in the archive seaparated by comma") 198 | 199 | args = vars(all_args.parse_args()) 200 | runtime_os = str(args['runtime_os']) 201 | runtime_arch = str(args['runtime_arch']) 202 | runtime_ver = str(args["runtime_ver"]) 203 | dashboard_ver = str(args["dashboard_ver"]) 204 | cli_ver = str(args["cli_ver"]) 205 | ARCHIVE_DIR = str(args["archive_dir"]) 206 | added_files = str(args["added_files"]) 207 | 208 | if runtime_ver == "latest" or runtime_ver == "": 209 | runtime_ver = getLatestRelease(GITHUB_DAPR_REPO) 210 | if dashboard_ver == "latest" or dashboard_ver == "": 211 | dashboard_ver = getLatestRelease(GITHUB_DASHBOARD_REPO) 212 | if cli_ver == "latest" or cli_ver == "": 213 | cli_ver = getLatestRelease(GITHUB_CLI_REPO) 214 | 215 | # Deletes a file if exists 216 | def deleteIfExists(dir): 217 | if os.path.exists(dir): 218 | if os.path.isdir(dir): 219 | shutil.rmtree(dir) 220 | else: 221 | os.remove(dir) 222 | 223 | # Writes details about versions, sub-folders, and images in `details.json` 224 | def write_details(dir): 225 | daprImageName = f"{DAPR_IMAGE}:{runtime_ver}" 226 | daprImageFileName = getFileName(daprImageName) 227 | details = { 228 | "daprd" : runtime_ver, 229 | "dashboard": dashboard_ver, 230 | "cli": cli_ver, 231 | "daprBinarySubDir": BIN_DIR, 232 | "dockerImageSubDir": IMAGE_DIR, 233 | "daprImageName": daprImageName, 234 | "daprImageFileName": daprImageFileName 235 | } 236 | jsonString = json.dumps(details) 237 | filePath = os.path.join(dir,detailsFileName) 238 | with open(filePath,'w') as f: 239 | f.write(jsonString) 240 | os.chmod(filePath, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) 241 | print(f"File {detailsFileName} is set to Read-Only") 242 | 243 | # Copies files, containing fileNames relative to current directory separated by comma, to `dir` 244 | def copy_files(dir,files): 245 | if files == "": 246 | return 247 | current_dir = os.getcwd() 248 | for file in files.split(","): 249 | filePath = os.path.join(current_dir,file) 250 | if os.path.exists(filePath): 251 | print(f"Copying {filePath} to {dir}") 252 | shutil.copy(filePath,dir) 253 | else: 254 | print(f"File {filePath} does not exist") 255 | 256 | #############Main################### 257 | 258 | #Parsing Arguments 259 | parseArguments() 260 | 261 | #Cleaning the bundle and archive directory 262 | deleteIfExists(BUNDLE_DIR) 263 | deleteIfExists(ARCHIVE_DIR) 264 | 265 | out_dir = BUNDLE_DIR 266 | #Downloading Binaries 267 | downloadBinaries(out_dir) 268 | 269 | #Downloading Docker images 270 | downloadDockerImages(out_dir) 271 | 272 | #writing versions 273 | write_details(out_dir) 274 | 275 | #Copying files 276 | copy_files(out_dir,added_files) 277 | 278 | #Archiving bundle 279 | make_archive(BUNDLE_DIR,ARCHIVE_DIR,DAPRBUNDLE_FILENAME) 280 | -------------------------------------------------------------------------------- /.github/scripts/get_release_version.py: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------ 2 | # Copyright 2021 The Dapr Authors 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # ------------------------------------------------------------ 13 | 14 | # This script parses release version from Git tag and set the parsed version to 15 | # environment variable, REL_VERSION. 16 | 17 | import os 18 | import sys 19 | 20 | gitRef = os.getenv("GITHUB_REF") 21 | tagRefPrefix = "refs/tags/v" 22 | 23 | with open(os.getenv("GITHUB_ENV"), "a") as githubEnv: 24 | if gitRef is None or not gitRef.startswith(tagRefPrefix): 25 | githubEnv.write("REL_VERSION=edge\n") 26 | githubEnv.write("RUNTIME_VERSION=latest\n") 27 | githubEnv.write("PRERELEASE=true\n") 28 | print ("This is daily build from {}...".format(gitRef)) 29 | sys.exit(0) 30 | 31 | releaseVersion = gitRef[len(tagRefPrefix):] 32 | 33 | if gitRef.find("-rc.") > 0: 34 | print ("Release Candidate build from {}...".format(gitRef)) 35 | githubEnv.write("PRERELEASE=true\n") 36 | else: 37 | # Set LATEST_RELEASE to true 38 | githubEnv.write("LATEST_RELEASE=true\n") 39 | githubEnv.write("PRERELEASE=false\n") 40 | print ("Release build from {}...".format(gitRef)) 41 | 42 | githubEnv.write("REL_VERSION={}\n".format(releaseVersion)) 43 | runtimeVersion = releaseVersion.split("+")[0] 44 | githubEnv.write("RUNTIME_VERSION={}\n".format(runtimeVersion)) 45 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------ 2 | # Copyright 2021 The Dapr Authors 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # ------------------------------------------------------------ 13 | 14 | 15 | 16 | name: dapr_bundle 17 | 18 | on: 19 | push: 20 | branches: 21 | - main 22 | - release-* 23 | tags: 24 | - v* 25 | workflow_dispatch: 26 | inputs: 27 | runtime_ver: 28 | description: "Dapr Runtime Version" 29 | required: false 30 | default: "latest" 31 | type: string 32 | cli_ver: 33 | description: "Dapr CLI Version" 34 | required: false 35 | default: "latest" 36 | type: string 37 | dashboard_ver: 38 | description: "Dapr Dashboard Version" 39 | required: false 40 | default: "latest" 41 | type: string 42 | 43 | pull_request: 44 | branches: 45 | - main 46 | - release-* 47 | 48 | 49 | jobs: 50 | build: 51 | name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} bundles 52 | runs-on: ubuntu-latest 53 | env: 54 | ARCHIVE_DIR: archives 55 | README_MD_FILE: README.md 56 | README_TXT_FILE: README.txt 57 | strategy: 58 | matrix: 59 | target_os: [linux, windows, darwin] 60 | target_arch: [amd64, arm64, arm] 61 | include: 62 | - target_os: linux 63 | - target_os: windows 64 | - target_os: darwin 65 | exclude: 66 | - target_os: windows 67 | target_arch: arm 68 | - target_os: windows 69 | target_arch: arm64 70 | - target_os: darwin 71 | target_arch: arm 72 | steps: 73 | - name: Checkout code into current directory 74 | uses: actions/checkout@v2 75 | 76 | - name: Installing python version > 3.7 77 | uses: actions/setup-python@v2 78 | with: 79 | python-version: '3.8' 80 | cache: 'pip' 81 | - run: pip install -r requirements.txt 82 | 83 | - name: Display Python version 84 | run: python --version 85 | 86 | - name: Parse release version and set REL_VERSION 87 | run: python ./.github/scripts/get_release_version.py 88 | 89 | - name: Check env variables 90 | run: | 91 | echo RELEASE VERSION: ${{env.REL_VERSION}} 92 | echo RUNTIME VERSION: ${{env.RUNTIME_VERSION}} 93 | echo GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME} 94 | 95 | - name: Create Readme.txt file 96 | shell: bash 97 | run: | 98 | cp ${{env.README_MD_FILE}} ${{env.README_TXT_FILE}} 99 | 100 | - name: Create and Archive bundle in workflow_dispatch 101 | if: github.event_name == 'workflow_dispatch' 102 | run: python ./.github/scripts/build_daprbundle.py --runtime_os=${{matrix.target_os}} --runtime_arch=${{matrix.target_arch}} --archive_dir=${{env.ARCHIVE_DIR}} --runtime_ver=${{inputs.runtime_ver}} --cli_ver=${{inputs.cli_ver}} --dashboard_ver=${{inputs.dashboard_ver}} --added_files=${{env.README_TXT_FILE}} 103 | 104 | - name: Create and Archive bundle without workflow_dispatch 105 | if: github.event_name != 'workflow_dispatch' 106 | run: python ./.github/scripts/build_daprbundle.py --runtime_os=${{matrix.target_os}} --runtime_arch=${{matrix.target_arch}} --archive_dir=${{env.ARCHIVE_DIR}} --runtime_ver=${{env.RUNTIME_VERSION}} --added_files=${{env.README_TXT_FILE}} 107 | 108 | - name: Upload artifacts 109 | uses: actions/upload-artifact@v4 110 | with: # Following the migration guide here https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md 111 | name: bundle_drop_${{ matrix.target_os }}_${{ matrix.target_arch }} 112 | path: ${{env.ARCHIVE_DIR}} 113 | publish: 114 | name: Publish Bundle created 115 | needs: build 116 | if: startswith(github.ref, 'refs/tags/v') 117 | env: 118 | ARTIFACT_DIR: ./release 119 | runs-on: ubuntu-latest 120 | steps: 121 | 122 | - name: Checkout code into current directory 123 | uses: actions/checkout@v2 124 | 125 | - name: Parse release version and set REL_VERSION 126 | run: python ./.github/scripts/get_release_version.py 127 | 128 | - name: download artifacts 129 | uses: actions/download-artifact@v4 130 | with: # Following the migration guide here https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md 131 | pattern: bundle_drop_* 132 | path: ${{env.ARTIFACT_DIR}} 133 | merge-multiple: true 134 | 135 | - name: generate checksum files 136 | run: cd ${ARTIFACT_DIR} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - 137 | 138 | - name: lists artifacts 139 | run: ls -l ${{ env.ARTIFACT_DIR }} 140 | 141 | - name: Upload release using ncipollo/release-action 142 | uses: ncipollo/release-action@v1 143 | with: 144 | artifacts: "${{ env.ARTIFACT_DIR }}/*" 145 | token: ${{ secrets.DAPR_BOT_TOKEN }} 146 | tag: "v${{ env.REL_VERSION }}" 147 | name: "Dapr Installer-Bundle v${{ env.REL_VERSION }}" 148 | prerelease: ${{ env.PRERELEASE }} 149 | allowUpdates: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | daprbundle/ 2 | archive/ -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These installer bundle owners are the maintainers and approvers of Dapr runtime 2 | * @dapr/maintainers-dapr @dapr/approvers-dapr 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dapr Installer Bundle 2 | 3 | ## Overview 4 | Dapr Installer Bundle contains CLI, runtime and dashboard packaged together. This eliminates the need to download binaries as well as docker images when initializing Dapr locally, especially in airgap/offline environment. The bundle structure is fixed and is as follows: 5 | ``` 6 | daprbundle 7 | ├── dapr 8 | ├── dist 9 | │   ├── daprd__.tar.gz (`.zip` for windows) 10 | │   ├── dashboard__.tar.gz (`.zip` for windows) 11 | │   ├── placement__.tar.gz (`.zip` for windows) 12 | │   ├── sentry__.tar.gz (`.zip` for windows) 13 | │   ├── scheduler__.tar.gz (`.zip` for windows) 14 | ├── docker 15 | │   ├── daprio/dapr-.tar.gz 16 | └── details.json 17 | ``` 18 | 19 | `details.json` file contains the following contents in json format: 20 | ``` 21 | { 22 | "daprd": , 23 | "dashboard": , 24 | "cli": , 25 | "daprBinarySubDir": , 26 | "dockerImageSubDir": , 27 | "daprImageName": , 28 | "daprImageFileName": 29 | } 30 | ``` 31 | 32 | > Note: `details.json` file has been set with Read-Only permissions (0444) by default. It is advised to not modify it's contents, which may lead to undefined behavior during Dapr initialization. 33 | 34 | ## Setup 35 | Each release of Dapr Installer Bundle includes various OSes and architectures. These packages can be manually downloaded and used to initialize dapr locally. 36 | 37 | 1. Download the [Dapr Installer Bundle](https://github.com/dapr/installer-bundle/releases) for the specific release version. For example, daprbundle_linux_amd64.tar.gz, daprbundle_windows_amd64.zip. 38 | 2. Unpack it. 39 | 3. To install Dapr CLI copy the `daprbundle/dapr (dapr.exe for Windows)` binary to the desired location: 40 | * For Linux/MacOS - `/usr/local/bin` 41 | * For Windows, create a directory and add this to your System PATH. For example create a directory called `c:\dapr` and add this directory to your path, by editing your system environment variable. 42 | 43 | > Note: If Dapr CLI is not moved to the desired location, you can use local `dapr` CLI binary in the bundle. The steps above is to move it to the usual location and add it to the path. 44 | 45 | ### Install Dapr on your local machine (self-hosted) 46 | 47 | In self-hosted mode, dapr can be initialized using the CLI with the placement container enabled by default(recommended) or without it(slim installation) which also does not require docker to be available in the environment. 48 | 49 | #### Initialize Dapr 50 | 51 | ([Prerequisite](#Prerequisites): Docker is available in the environment - recommended) 52 | 53 | Use the init command to initialize Dapr. On init, default configuration file and containers are installed along with the dapr runtime binary. Dapr runtime binary is installed under $HOME/.dapr/bin for Mac, Linux and %USERPROFILE%\.dapr\bin for Windows. 54 | 55 | Move to the bundle directory and run the following command: 56 | ``` bash 57 | dapr init --from-dir . 58 | ``` 59 | > For linux users, if you run your docker cmds with sudo, you need to use "**sudo dapr init**" 60 | 61 | > If you are not running the above cmd from the bundle directory, provide the full path to bundle directory as input. e.g. assuming bundle directory path is $HOME/daprbundle, run `dapr init --from-dir $HOME/daprbundle` to have the same behavior. 62 | 63 | 64 | Output should look like as follows: 65 | ```bash 66 | Making the jump to hyperspace... 67 | ℹ️ Installing runtime version latest 68 | ↘ Extracting binaries and setting up components... Loaded image: daprio/dapr:$version 69 | ✅ Extracting binaries and setting up components... 70 | ✅ Extracted binaries and completed components set up. 71 | ℹ️ daprd binary has been installed to $HOME/.dapr/bin. 72 | ℹ️ dapr_placement container is running. 73 | ℹ️ Use `docker ps` to check running containers. 74 | ✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started 75 | ``` 76 | > Note: To see that Dapr has been installed successfully, from a command prompt run the `docker ps` command and check that the `daprio/dapr:$version` container is up and running. 77 | 78 | This step creates the following defaults: 79 | 80 | 1. an empty components folder which is later used during `dapr run` unless the `--components-path` option is provided. For Linux/MacOS, the default components folder path is `$HOME/.dapr/components` and for Windows it is `%USERPROFILE%\.dapr\components`. 81 | 2. default config file `$HOME/.dapr/config.yaml` for Linux/MacOS or for Windows at `%USERPROFILE%\.dapr\config.yaml`. Can be overridden with the `--config` flag on `dapr run`. 82 | 83 | > Note: To emulate *online* dapr initialization using `dapr init`, you can also run redis/zipkin containers as follows. You would also need to update the default config file to enable tracing and add component files in the components folder to load them on `dapr init` call: 84 | ``` 85 | 1. docker run --name "dapr_zipkin" --restart always -d -p 9411:9411 openzipkin/zipkin 86 | 2. docker run --name "dapr_redis" --restart always -d -p 6379:6379 redislabs/rejson 87 | ``` 88 | 89 | #### Slim Init 90 | Alternatively to the above, to have the CLI not install any default configuration files or run Docker containers, use the `--slim` flag with the init command. Only Dapr binaries will be installed. 91 | 92 | ``` bash 93 | dapr init --slim --from-dir . 94 | ``` 95 | 96 | Output should look like this: 97 | ```bash 98 | ⌛ Making the jump to hyperspace... 99 | ℹ️ Installing runtime version latest 100 | ↙ Extracting binaries and setting up components... 101 | ✅ Extracting binaries and setting up components... 102 | ✅ Extracted binaries and completed components set up. 103 | ℹ️ daprd binary has been installed to $HOME.dapr/bin. 104 | ℹ️ placement binary has been installed to $HOME/.dapr/bin. 105 | ✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started 106 | ``` 107 | 108 | >Note: When initializing Dapr with the `--slim` flag only the Dapr runtime binary and the placement service binary are installed. An empty default components folder is created with no default configuration files. During `dapr run` user should use `--components-path` to point to a components directory with custom configurations files or alternatively place these files in the default directory. For Linux/MacOS, the default components directory path is `$HOME/.dapr/components` and for Windows it is `%USERPROFILE%\.dapr\components`. 109 | 110 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.24.0 2 | semver==2.13.0 --------------------------------------------------------------------------------