OLD | NEW |
1 -------- | 1 -------- |
2 Overview | 2 Overview |
3 | 3 |
4 This is a Google App Engine server which serves the documentation for Chrome | 4 This is a Google App Engine server which serves the documentation for Chrome |
5 apps and extensions. At time of this writing, the primary URL is: | 5 apps and extensions. At time of this writing, the primary URL is: |
6 http://developer.chrome.com/. | 6 http://developer.chrome.com/. |
7 | 7 |
8 | 8 |
9 --------------------- | 9 --------------------- |
10 Developing the Server | 10 Developing the Server |
11 | 11 |
12 You shouldn't need app engine locally to develop the server, preview.py should | 12 You shouldn't need app engine locally to develop the server, preview.py should |
13 be sufficient. If for some reason you want to test against the app engine SDK: | 13 be sufficient. If for some reason you want to test against the app engine SDK: |
14 | 14 |
15 1. Download the python Google App Engine SDK from: | 15 1. Download the python Google App Engine SDK from: |
16 https://developers.google.com/appengine/downloads | 16 https://developers.google.com/appengine/downloads |
17 | 17 |
18 2. Run './start_dev_server.py <path/to/dev_appserver.py>' | 18 2. Run './start_dev_server.py <path/to/dev_appserver.py>' |
19 (dev_appserver.py is part of the App Engine) | 19 (dev_appserver.py is part of the App Engine) |
20 | 20 |
21 3. View docs at http://localhost:8080/(apps|extensions)/<doc_name> | 21 3. View docs at http://localhost:8080/(apps|extensions)/<doc_name> |
22 | 22 |
| 23 NOTE: The dev server will not work right way: you need to populate its |
| 24 Datastore. You will need a local datastore cache in the working directory where |
| 25 you started the dev server, and you will need to manually instruct the dev |
| 26 server to pull data from that file: |
23 | 27 |
24 -------------------------------------------- | 28 1. Run './update_cache.py --no-push --save-file=FOOCACHE'. This will take |
25 Using Google Cloud Storage content providers | 29 a very long time (30-40 minutes). It is advisable that you keep a copy |
| 30 of this file around if you plan use the dev server often. It can be |
| 31 updated much faster (< 3 minutes) in that case by also including |
| 32 --load-file=FOOCACHE on subsequent update_cache.py runs. |
26 | 33 |
27 With preview.py: | 34 You MUST have branch heads fetched in your local repo in order for your |
| 35 local data set to be populated correctly. You can accomplish this by |
| 36 running: |
| 37 |
| 38 gclient sync --with_branch_heads |
| 39 git fetch origin |
| 40 |
| 41 You may also specify --commit=<commitish> when running update_cache.py in |
| 42 order to update the cache from a specific commit. This may be a commit ID, |
| 43 or a partial commit ID, or a local branch ref, etc. To test local changes, |
| 44 you MUST commit them locally and use the local commit to update your cache. |
| 45 |
| 46 2. Once you have a cache (e.g. FOOCACHE) in the working directory of your |
| 47 dev server, visit the URL: |
| 48 |
| 49 http://localhost:8080/_update_cache/FOOCACHE |
| 50 |
| 51 The server should take about a minute to fully populate its Datastore |
| 52 from the data in your FOOCACHE file. Now you have a working dev server! |
| 53 |
| 54 |
| 55 ------------------------------------------------------------ |
| 56 Using Google Cloud Storage content providers with preview.py |
28 | 57 |
29 1. create a directory "[...]/server2/local_debug/gcs/<bucketname>" for every | 58 1. create a directory "[...]/server2/local_debug/gcs/<bucketname>" for every |
30 gcs bucket referenced in content_providers.json | 59 gcs bucket referenced in content_providers.json |
31 | 60 |
32 2. copy files to the respective local bucket directories. Preview.py has | 61 2. copy files to the respective local bucket directories. Preview.py has |
33 no access to the real Google Cloud Storage. | 62 no access to the real Google Cloud Storage. |
34 | 63 |
35 With start_dev_server.py: | |
36 | |
37 1. Install gsutils from https://developers.google.com/storage/docs/gsutil | |
38 | |
39 2. Set gsutil accordingly to the official instructions. | |
40 | |
41 3. Make sure you have permission to the GCS buckets specified in | |
42 content_providers.json by running "gsutil ls gs://bucketname" | |
43 | |
44 4. Get an oauth token (see instructions at the comment of | |
45 gcs_file_system_provider.py) and save it to the file | |
46 "[...]/server2/local_debug/gcs_debug.conf" | |
47 | |
48 Remember that the step 4 needs to be repeated every 10 minutes or so, | |
49 because the oauth access token expires quickly. | |
50 | 64 |
51 -------------------- | 65 -------------------- |
52 Deploying the Server | 66 Deploying the Server |
53 | 67 |
54 You will need to have access to the http://chrome-apps-doc.appspot.com app. | 68 You will need to have access to the http://chrome-apps-doc.appspot.com app. |
55 Contact aa@chromium.org, erikkay@chromium.org, miket@chromium.org, | 69 Contact kalman@chromium.org or rockot@chromium.org to obtain access. |
56 kalman@chromium.org, or ernestd@chromium.org to obtain access. | |
57 | 70 |
58 Once you have access: | 71 Once you have access: |
59 | 72 |
60 1. Increment the version in app.yaml so we can roll back if the update breaks. | 73 1. Increment the version in app.yaml so we can roll back if the update breaks. |
61 | 74 |
62 2. Run build_server.py. This copies some depenencies from /third_party into the | 75 2. Run build_server.py. This copies some depenencies from /third_party into the |
63 server directory so that they get uploaded to App Engine. | 76 server directory so that they get uploaded to App Engine. |
64 | 77 |
65 3. Run appcfg.py (supplied with the App Engine SDK) to upload the server code: | 78 3. Run appcfg.py (supplied with the App Engine SDK) to upload the server code: |
66 | 79 |
67 appcfg.py update . | 80 appcfg.py update . |
68 | 81 |
69 4. When prompted for your credentials, enter the information for the account | 82 4. When prompted for your credentials, enter the information for the account |
70 that has access to the production app. | 83 that has access to the production app. |
71 | 84 |
72 5. Go to http://www.appspot.com, select the docs project, click "versions" in | 85 5. Go to http://www.appspot.com, select the docs project, click "versions" in |
73 the sidebar, and make the version you just deployed the "default" version. | 86 the sidebar, and make the version you just deployed the "default" version. |
74 | 87 |
75 If you get an error about too many versions when deploying, go into this | 88 If you get an error about too many versions when deploying, go into this |
76 view and delete the version which was deployed the longest time ago. Then | 89 view and delete the version which was deployed the longest time ago. Then |
77 try to deploy again. | 90 try to deploy again. |
| 91 |
| 92 |
| 93 ---------------------- |
| 94 Updating the Datastore |
| 95 |
| 96 Even when the server code hasn't changed, new data is constantly flowing into |
| 97 the chromium repo and some of that data includes changes to new or existing |
| 98 content hosted by the server. In order for the front-end to reflect these |
| 99 changes, new data must be pushed into the project's Datastore. |
| 100 |
| 101 This is done periodically by a Compute Engine instance running the |
| 102 update_cache.py tool. While it is possible to push from other hosts if you |
| 103 get all the right credentials in all the right places, it is strongly |
| 104 discouraged and also therefore not documented. |
| 105 |
| 106 To force a push safely from the VM, navigate to the developer console under |
| 107 Compute -> Compute Engine -> VM instances and open SSH for the "git-processor" |
| 108 instance. From within the SSH session, first switch to user "git-processor": |
| 109 |
| 110 sudo su - git-processor |
| 111 |
| 112 You can run './update-docs.sh' from the home directory there. This will |
| 113 automatically fetch any new objects from the upstream repository and then |
| 114 perform a full update if there are pending changes. |
| 115 |
| 116 It's almost never necessary to use this tool. For one interesting example, |
| 117 consider the case where no new commits are landing in the chrome repository |
| 118 but a change was just pushed to one of the GCS providers (like say, the |
| 119 chromedocs-multidevice bucker). In this case, you may want to force an update |
| 120 of only the content_providers data. |
| 121 |
| 122 ./update_docs.sh --data-source=content_providers --force |
| 123 |
| 124 This will safely do the push for you, ensuring that the automated job |
| 125 does not collide with your own. |
| 126 |
OLD | NEW |