Tom Hughes | 4af1fe0 | 2019-08-02 00:42:37 | [diff] [blame] | 1 | # Dev Server |
| 2 | |
| 3 | [TOC] |
| 4 | |
| 5 | ## Overview |
| 6 | |
| 7 | The dev server allows you to update your Chromium OS machine with new builds |
| 8 | without having to copy them via a USB drive. It also serves as a static file |
| 9 | repository, allowing you to install your own packages and scripts making it easy |
| 10 | to customize your machine for development purposes. |
| 11 | |
| 12 | Note: Every time you create a Chromium OS build, the URL of the dev server |
| 13 | corresponding to your development machine is put into `/etc/lsb-release`. This |
| 14 | file can be changed post-installation to manage a test machine's update source |
| 15 | or can be overridden in `/mnt/stateful_partition/etc/lsb-release`. |
| 16 | |
| 17 | ## Starting the Dev Server |
| 18 | |
| 19 | Note: Before you start the dev server, you must have already run |
Jack Rosenthal | d05fb3c | 2023-06-17 01:46:32 | [diff] [blame] | 20 | `cros build-packages`. If you have not, please run this now. |
Tom Hughes | 4af1fe0 | 2019-08-02 00:42:37 | [diff] [blame] | 21 | |
| 22 | The first step in using the dev server is starting the web server on your |
| 23 | development machine: |
| 24 | |
| 25 | ```bash |
| 26 | (chroot)$ start_devserver |
| 27 | ``` |
| 28 | |
| 29 | ## Using the Dev Server |
| 30 | |
| 31 | ### Options |
| 32 | |
| 33 | Note that by default the devserver serves the latest image and runs on port |
| 34 | 8080. You can change this among many other things. Here is a brief description |
| 35 | of some of the options. Please see `start_devserver --help` for more |
| 36 | information. |
| 37 | |
| 38 | * `--use_cached` - Forces the devserver to use the `update.gz` it finds in its |
| 39 | static dir. This allows you to pre-generate an update payload and place it |
| 40 | in the devserver's static file hosting directory |
| 41 | (`~/src/platform/dev/static`). |
| 42 | * `--src_image` - Generates a delta update based from the target image on the |
| 43 | source image. If the source image you provide is not the image on the |
| 44 | machine, the delta update will fail. Note that delta updates despite their |
| 45 | name run slower than full updates (but will save you bandwidth). |
| 46 | * `--pregenerate_update` - Generates the update before starting the dev |
| 47 | server. This keeps from getting nasty timeouts for big update payloads |
| 48 | _(necessary for most delta updates)._ |
| 49 | * `--image` - Serve this image to a machine that requests it. |
| 50 | * `--port` - Start the devserver on this port. |
| 51 | * `-t` - From the directory (using the latest image and/or using the archive |
| 52 | logic) use the test image found in that directory |
| 53 | (`chromiumos_test_image.bin`) |
| 54 | * `--static_dir` - Serve images from a file structure. Clients can prefix |
| 55 | which image they want in their request by modifying their `omaha_url`. By |
| 56 | default this changes the static directory to `~/src/platform/dev/static`. |
| 57 | |
| 58 | ## Using Devserver to Stage and Serve Artifacts from Google Storage |
| 59 | |
| 60 | A running devserver listens for calls to its stage and xBuddy RPCs. |
| 61 | |
| 62 | ### Stage RPC |
| 63 | |
| 64 | An abbreviated version of the documentation for the stage RPC is copied here, |
| 65 | but the up to date version can be found by going to host:port/doc/stage on any |
| 66 | running devserver. |
| 67 | |
| 68 | Downloads and caches the artifacts Google Storage URL. Returns once these have |
| 69 | been downloaded on the devserver. A call to this will attempt to cache |
| 70 | non-specified artifacts in the background for the given from the given URL |
| 71 | following the principle of spatial locality. Spatial locality of different |
| 72 | artifacts is explicitly defined in the build_artifact module. These artifacts |
| 73 | will then be available from the `static/` sub-directory of the devserver. |
| 74 | |
| 75 | To download the autotest and test suites tarballs: |
| 76 | |
| 77 | ``` |
| 78 | http://devserver_url:/stage?archive_url=gs://your_url/path&artifacts=autotest,test_suites |
| 79 | ``` |
| 80 | |
| 81 | To download the full update payload: |
| 82 | |
| 83 | ``` |
| 84 | http://devserver_url:/stage?archive_url=gs://your_url/path&artifacts=full_payload |
| 85 | ``` |
| 86 | |
| 87 | To download just a file called `blah.bin`: |
| 88 | |
| 89 | ``` |
| 90 | http://devserver_url:/stage?archive_url=gs://your_url/path&files=blah.bin |
| 91 | ``` |
| 92 | |
| 93 | ### xBuddy RPC |
| 94 | |
| 95 | See [xBuddy for Devserver]. |
| 96 | |
| 97 | ## Feature Requests |
| 98 | |
| 99 | There are many things that can be done to improve this system. Feel free to make |
| 100 | suggestions and submit patches. |
| 101 | |
Mike Frysinger | c352d3b | 2024-04-05 20:10:11 | [diff] [blame] | 102 | [xBuddy for Devserver]: https://www.chromium.org/chromium-os/developer-library/reference/tools/xbuddy/ |