2019-01-03 00:59:01 +03:00
|
|
|
|
# Oryx
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2022-11-29 04:02:02 +03:00
|
|
|
|
[![Build Status](https://devdiv.visualstudio.com/DevDiv/_apis/build/status/Oryx/Oryx-Nightly?branchName=main)](https://devdiv.visualstudio.com/DevDiv/_build/latest?definitionId=10393&branchName=main)
|
2019-01-08 02:25:14 +03:00
|
|
|
|
|
2019-01-03 00:59:01 +03:00
|
|
|
|
Oryx is a build system which automatically compiles source code repos into
|
2019-03-15 01:24:05 +03:00
|
|
|
|
runnable artifacts. It is used to build web apps for [Azure App Service][] and
|
|
|
|
|
other platforms.
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
To receive updates on runtimes and versions supported by Oryx and App Service,
|
|
|
|
|
subscribe to [Azure Updates][] or watch the
|
|
|
|
|
[github.com/Azure/app-service-announcements](https://github.com/Azure/app-service-announcements)
|
|
|
|
|
tracker.
|
|
|
|
|
|
|
|
|
|
[Azure App Service]: https://azure.microsoft.com/services/app-service/
|
|
|
|
|
[Azure Updates]: https://azure.microsoft.com/updates
|
|
|
|
|
|
|
|
|
|
Oryx generates and runs an opinionated build script within a *build* container
|
|
|
|
|
based on analysis of a codebase's contents. For example, if `package.json` is
|
|
|
|
|
discovered in the repo Oryx includes `npm run build` in the build script; or if
|
|
|
|
|
`requirements.txt` is found it includes `pip install -r requirements.txt`.
|
|
|
|
|
|
|
|
|
|
Oryx also generates a run-time startup script for the app including typical
|
|
|
|
|
start commands like `npm run start` for Node.js or a WSGI module and server
|
|
|
|
|
for Python.
|
|
|
|
|
|
|
|
|
|
The built artifacts and start script are loaded into a minimalistic *run*
|
|
|
|
|
container and run.
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2020-11-22 12:14:38 +03:00
|
|
|
|
# Supported platforms and versions
|
|
|
|
|
|
2022-08-23 04:16:47 +03:00
|
|
|
|
[Link](./doc/supportedPlatformVersions.md)
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
|
|
|
|
Patches (0.0.**x**) are applied as soon as possible after they are released upstream.
|
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
# Get started
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
Though built first for use within Azure services, you can also use the Oryx
|
|
|
|
|
build system yourself for troubleshooting and tests. Following are simple
|
|
|
|
|
instructions; for complete background see our [architecture
|
|
|
|
|
doc](./doc/architecture.md).
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
|
|
|
|
Oryx includes two command-line applications; the first is included in the
|
2019-03-15 01:24:05 +03:00
|
|
|
|
*build* image and generates a build script by analyzing a codebase. The second
|
|
|
|
|
is included in *run* images and generates a startup script. Both are aliased
|
|
|
|
|
and accessible as `oryx` in their respective images.
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
### `oryx build`
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
When `oryx build` is run, the system detects which programming platforms appear
|
|
|
|
|
to be in use and applies toolsets appropriate for each one. You can override
|
|
|
|
|
the default choices through [configuration](./doc/configuration.md#oryx-configuration).
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
The `--output` (or `-o`) parameter specifies where prepared artifacts will be
|
|
|
|
|
placed; if not specified the source directory is used for output as well.
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
For all options, specify `oryx --help`.
|
2019-01-26 05:07:56 +03:00
|
|
|
|
|
2022-02-21 10:29:18 +03:00
|
|
|
|
### `oryx create-script -appPath`
|
|
|
|
|
|
|
|
|
|
When `oryx` is run in the runtime images it generates a start script named
|
|
|
|
|
run.sh, by default in the same folder as the compiled artifact.
|
|
|
|
|
|
2022-03-03 06:14:13 +03:00
|
|
|
|
## Support for Build Configuration File
|
2022-02-08 17:58:48 +03:00
|
|
|
|
|
2023-03-08 21:47:34 +03:00
|
|
|
|
The App Service YAML file (`appsvc.yaml`) is used to specify the build and run commands for your Web Apps, thus
|
|
|
|
|
overriding any defaults provided by the App Service Build Service. App Service expects this file to be in the root
|
|
|
|
|
directory of your project.
|
2022-02-08 17:58:48 +03:00
|
|
|
|
|
2023-03-08 21:47:34 +03:00
|
|
|
|
### Format
|
2022-02-08 17:58:48 +03:00
|
|
|
|
|
2023-03-08 21:47:34 +03:00
|
|
|
|
There are ordered keys for `pre-build`, `post-build`, and `run`. The commands/scripts referenced by these keys are
|
|
|
|
|
executed in-order. If a key is missing, it will be skipped and the next key will be processed. An optional `version` key
|
|
|
|
|
specifies the version of the `appsvc.yaml` file, if new versions are introduced in the future.
|
|
|
|
|
|
|
|
|
|
```yaml
|
2022-02-08 17:58:48 +03:00
|
|
|
|
version: 1
|
|
|
|
|
|
2023-03-08 21:47:34 +03:00
|
|
|
|
pre-build: apt-get install jq
|
2022-02-08 17:58:48 +03:00
|
|
|
|
|
2023-03-08 21:47:34 +03:00
|
|
|
|
post-build: |
|
|
|
|
|
python manage.py makemigrations
|
|
|
|
|
python manage.py migrate
|
2022-02-08 17:58:48 +03:00
|
|
|
|
|
2023-03-08 21:47:34 +03:00
|
|
|
|
run: gunicorn myapp.app --workers 5
|
|
|
|
|
```
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2019-01-03 00:59:01 +03:00
|
|
|
|
## Build and run an app
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2019-03-15 01:24:05 +03:00
|
|
|
|
To build and run an app from a repo, follow these approximate steps. An example
|
|
|
|
|
script follows.
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
2019-03-25 23:40:28 +03:00
|
|
|
|
1. Mount the repo as a volume in Oryx's `docker.io/oryxprod/build` container.
|
2019-03-15 01:24:05 +03:00
|
|
|
|
1. Run `oryx build ...` within the repo directory to build a runnable artifact.
|
|
|
|
|
1. Mount the output directory from build in an appropriate Oryx "run"
|
2019-03-25 23:40:28 +03:00
|
|
|
|
container, such as `docker.io/oryxprod/node-10.14`.
|
2019-03-15 01:24:05 +03:00
|
|
|
|
1. Run `oryx ...` within the "run" container to write a startup script.
|
2019-03-25 23:40:28 +03:00
|
|
|
|
1. Run the generated startup script, by default `/run.sh`.
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
|
|
|
|
```bash
|
2019-03-15 01:24:05 +03:00
|
|
|
|
# Run these from the root of the repo.
|
2019-01-03 00:59:01 +03:00
|
|
|
|
# build
|
|
|
|
|
docker run --volume $(pwd):/repo \
|
2020-12-10 20:18:25 +03:00
|
|
|
|
'mcr.microsoft.com/oryx/build:latest' \
|
2019-03-25 23:40:28 +03:00
|
|
|
|
oryx build /repo --output /repo
|
2019-01-03 00:59:01 +03:00
|
|
|
|
|
|
|
|
|
# run
|
2019-03-25 23:40:28 +03:00
|
|
|
|
|
|
|
|
|
# the -p/--publish and -e/--env flags specify and open a host port
|
2019-01-03 00:59:01 +03:00
|
|
|
|
docker run --detach --rm \
|
2019-03-25 23:40:28 +03:00
|
|
|
|
--volume $(pwd):/app \
|
|
|
|
|
--env PORT=8080 \
|
|
|
|
|
--publish 8080:8080 \
|
2020-12-10 20:18:25 +03:00
|
|
|
|
'mcr.microsoft.com/oryx/node:10' \
|
2020-02-19 02:41:25 +03:00
|
|
|
|
sh -c 'oryx create-script -appPath /app && /run.sh'
|
2019-01-03 00:59:01 +03:00
|
|
|
|
```
|
|
|
|
|
|
2022-02-09 02:52:23 +03:00
|
|
|
|
## Build Server Invocation
|
|
|
|
|
1. Build the Oryx solution
|
|
|
|
|
1. ![Build Solutionpng](doc/buildServer/buildSolution.png)
|
|
|
|
|
1. Create image with oryx and platform binaries
|
|
|
|
|
1. `time build/buildBuildImages.sh -t ltsversion`
|
2023-03-08 21:47:34 +03:00
|
|
|
|
1. Run docker to port map, volume mount a directory, specify the image with `oryx build`, and invoke BuildServer
|
2022-02-09 02:52:23 +03:00
|
|
|
|
1. ```bash
|
|
|
|
|
docker run -it -p 8086:80 \
|
|
|
|
|
-v C:\Repo\Oryx\tests\SampleApps\:/tmp/SampleApps \
|
|
|
|
|
-e "ASPNETCORE_URLS=http://+80" \
|
|
|
|
|
oryxdevmcr.azurecr.io/public/oryx/build:lts-versions \
|
|
|
|
|
/opt/buildscriptgen/BuildServer
|
2023-03-08 21:47:34 +03:00
|
|
|
|
```
|
2022-02-09 02:52:23 +03:00
|
|
|
|
![Start](doc/buildServer/start.png)
|
|
|
|
|
1. Invoke build
|
|
|
|
|
1. ![Post](doc/buildServer/post.png)
|
|
|
|
|
1. Under the hood `oryx build` is invoked
|
|
|
|
|
```bash
|
|
|
|
|
oryx build [sourcePath] \
|
|
|
|
|
--platform [platform] \
|
|
|
|
|
--platform-version [version] \
|
|
|
|
|
--output [outputPath] \
|
|
|
|
|
--log-file [logPath]
|
|
|
|
|
```
|
|
|
|
|
1. Check build status with id `1`
|
|
|
|
|
1. ![Status](doc/buildServer/status.png)
|
|
|
|
|
1. Check server healthcheck
|
|
|
|
|
1. ![Health Check](doc/buildServer/healthCheck.png)
|
|
|
|
|
|
2019-04-11 01:21:10 +03:00
|
|
|
|
# Components
|
|
|
|
|
|
2019-06-05 03:45:05 +03:00
|
|
|
|
Oryx consists of a build image, a collection of runtime images, a build script generator, and a collection of
|
|
|
|
|
startup script generators. For more details, refer to our [architecture](./doc/architecture.md) page.
|
2019-04-11 01:21:10 +03:00
|
|
|
|
|
2022-04-16 02:08:19 +03:00
|
|
|
|
# Testing Locally
|
|
|
|
|
## startup script generator
|
2022-12-13 23:45:01 +03:00
|
|
|
|
`build/testStartupScriptGenerators.sh` will perform tests on all startup script generators written in go.
|
2022-04-16 02:08:19 +03:00
|
|
|
|
The tests are copied into a docker image for performing `go test` on all platforms.
|
|
|
|
|
|
2019-01-03 00:59:01 +03:00
|
|
|
|
# Contributing
|
|
|
|
|
|
|
|
|
|
See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
2018-12-12 05:22:43 +03:00
|
|
|
|
|
2018-11-13 02:59:17 +03:00
|
|
|
|
# License
|
|
|
|
|
|
|
|
|
|
MIT, see [LICENSE.md](./LICENSE.md).
|
|
|
|
|
|
2019-01-03 00:59:01 +03:00
|
|
|
|
# Security
|
|
|
|
|
|
|
|
|
|
Security issues and bugs should be reported privately, via email, to the
|
|
|
|
|
Microsoft Security Response Center (MSRC) at
|
|
|
|
|
[secure@microsoft.com](mailto:secure@microsoft.com). You should receive a
|
|
|
|
|
response within 24 hours. If for some reason you do not, please follow up via
|
|
|
|
|
email to ensure we received your original message. Further information,
|
|
|
|
|
including the [MSRC
|
|
|
|
|
PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found
|
|
|
|
|
in the [Security
|
|
|
|
|
TechCenter](https://technet.microsoft.com/en-us/security/default).
|
|
|
|
|
|
2022-04-28 19:15:06 +03:00
|
|
|
|
# Trademark
|
|
|
|
|
|
|
|
|
|
This project may contain trademarks or logos for projects, products, or services.
|
|
|
|
|
Authorized use of Microsoft trademarks or logos is subject to and must follow
|
|
|
|
|
[Microsoft’s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks).
|
|
|
|
|
Use of Microsoft trademarks or logos in modified versions of this project must not
|
|
|
|
|
cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks
|
|
|
|
|
or logos are subject to those third-party’s policies.
|
|
|
|
|
|
2019-01-03 00:59:01 +03:00
|
|
|
|
# Data/Telemetry
|
|
|
|
|
|
|
|
|
|
When utilized within Azure services, this project collects usage data and
|
|
|
|
|
sends it to Microsoft to help improve our products and services. Read
|
|
|
|
|
[Microsoft's privacy statement][] to learn more.
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2019-01-03 00:59:01 +03:00
|
|
|
|
[Microsoft's privacy statement]: http://go.microsoft.com/fwlink/?LinkId=521839
|
2018-11-13 02:59:17 +03:00
|
|
|
|
|
2019-01-03 00:59:01 +03:00
|
|
|
|
This project follows the [Microsoft Open Source Code of Conduct][coc]. For
|
|
|
|
|
more information see the [Code of Conduct FAQ][cocfaq]. Contact
|
2018-11-13 02:59:17 +03:00
|
|
|
|
[opencode@microsoft.com][cocmail] with questions and comments.
|
|
|
|
|
|
|
|
|
|
[coc]: https://opensource.microsoft.com/codeofconduct/
|
|
|
|
|
[cocfaq]: https://opensource.microsoft.com/codeofconduct/faq/
|
|
|
|
|
[cocmail]: mailto:opencode@microsoft.com
|
2020-06-06 01:41:13 +03:00
|
|
|
|
|
|
|
|
|
## Disable Data Collection
|
|
|
|
|
|
2023-03-08 21:47:34 +03:00
|
|
|
|
To prevent Oryx command line tools from collecting any data, set the environment variable
|
2020-06-06 01:41:13 +03:00
|
|
|
|
`ORYX_DISABLE_TELEMETRY` to `true`.
|