OILS / soil / web-init.sh View on Github | oilshell.org

165 lines, 42 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# soil/web-init.sh <function name>
5#
6# Examples:
7# soil/web-init.sh deploy-data # CSS, JS, etc.
8# soil/web-init.sh deploy-code # web.py and its dependencies
9
10set -o nounset
11set -o pipefail
12set -o errexit
13
14source soil/common.sh # for SOIL_USER and SOIL_HOST
15
16# Notes on setting up travis-ci.oilshell.org
17#
18# - Create the domain and user with dreamhost
19# - Set it up to serve out of .wwz files (in dreamhost repo)
20# - Deploy public key. (Private key is encrypted and included in the repo.)
21
22#
23# Run inside the Travis build
24#
25
26home-page() {
27 ### travis-ci.oilshell.org home page
28
29 local domain=${1:-'travis-ci.oilshell.org'}
30 local title="Soil on $domain"
31 soil-html-head "$title"
32
33 cat <<EOF
34 <body class="width40">
35 <p id="home-link">
36 <a href="//oilshell.org/">oilshell.org</a>
37 </p>
38
39 <h1>$title</h1>
40
41 <p>This server receives results from cloud build services.
42 See <a href="https://github.com/oilshell/oil/wiki/Soil">Soil</a> for details.
43 </p>
44
45 <table>
46 <thead>
47 <tr>
48 <td>Recent Jobs</td>
49 <td>Service Home</td>
50 <td>Config</td>
51 </tr>
52 </thead>
53
54 <tr>
55 <td>
56 <a href="srht-jobs/">sr.ht</a>
57 </td>
58 <td>
59 <a href="https://builds.sr.ht/~andyc">builds.sr.ht</a>
60 </td>
61 <td></td>
62 </tr>
63
64 <tr>
65 <td>
66 <a href="github-jobs/">Github Actions</a>
67 </td>
68 <td>
69 <a href="https://github.com/oilshell/oil/actions/workflows/all-builds.yml">github.com</a>
70 </td>
71 <td></td>
72 </tr>
73
74 <tr>
75 <td>
76 <a href="circle-jobs/">Circle CI</a>
77 </td>
78 <td>
79 <a href="https://app.circleci.com/pipelines/github/oilshell/oil">app.circleci.com</a>
80 </td>
81 <td></td>
82 </tr>
83
84 <tr>
85 <td>
86 <a href="cirrus-jobs/">Cirrus</a>
87 </td>
88 <td>
89 <a href="https://cirrus-ci.com/github/oilshell/oil">cirrus-ci.com</a>
90 </td>
91 <td></td>
92 </tr>
93
94 <tr>
95 <td>
96 <a href="travis-jobs/">Travis CI</a> (obsolete)
97 </td>
98 <td>
99 <a href="https://app.travis-ci.com/github/oilshell/oil">app.travis-ci.com</a>
100 </td>
101 <td></td>
102 </tr>
103
104 </table>
105
106 <h1>Links</h1>
107
108 <ul>
109 <li>
110 <a href="status-api/github/">static-api/github/</a>
111 </li>
112 </ul>
113
114 </body>
115</html>
116EOF
117}
118
119deploy-data() {
120 local user=${1:-$SOIL_USER}
121 local host=${2:-$SOIL_HOST}
122
123 ssh $user@$host mkdir -v -p \
124 $host/{travis-jobs,srht-jobs,github-jobs,circle-jobs,cirrus-jobs,web,status-api/github} \
125 $host/web/table
126
127 home-page "$host" > _tmp/index.html
128
129 # note: duplicating CSS
130 scp _tmp/index.html $user@$host:$host/
131 scp web/{base.css,soil.css,ajax.js} $user@$host:$host/web
132 scp web/table/*.{js,css} $user@$host:$host/web/table
133}
134
135soil-web-manifest() {
136 PYTHONPATH=. /usr/bin/env python2 \
137 build/dynamic_deps.py py-manifest soil.web \
138 | grep oilshell/oil # only stuff in the repo
139
140 # Add a shell script
141 echo $PWD/soil/web.sh soil/web.sh
142 echo $PWD/soil/common.sh soil/common.sh
143}
144
145# Also used in test/wild.sh
146multi() { ~/git/tree-tools/bin/multi "$@"; }
147
148deploy-code() {
149 soil-web-manifest | multi cp _tmp/soil-web
150 tree _tmp/soil-web
151 rsync --archive --verbose _tmp/soil-web/ $SOIL_USER_HOST:soil-web/
152}
153
154deploy() {
155 deploy-data
156 deploy-code
157}
158
159remote-test() {
160 ssh $SOIL_USER_HOST \
161 soil-web/soil/web.sh smoke-test '~/travis-ci.oilshell.org/jobs'
162}
163
164
165"$@"