Skip to content

Commit dbc4ca5

Browse files
authored
Put everything needed for deploys in deploy bundles (#153)
The aim of this commit is to allow Travis to create deploy bundles for both the client and the server on tags so that everything we need for a deployment is contained in the deploy bundles. There are two separate bundles: one for the server, which includes the trypurescript binary as well as nginx configuration and the systemd service file, and one for the client, which just includes the HTML, CSS, and JS files we serve from try.purescript.org. The server bundle already exists; I have only modified it to additionally include nginx and systemd configuration. The reason for this is that I would prefer to have as much as reasonably possible of the production config in the repository, so that we can move towards more automated deployments, and also to help avoid a situation where only one person understands enough about the server setup to be able to administer it. For the client bundle, I've moved stuff we want to be publicly visible into a separate public/ directory, mostly because I don't want to include things like the output/ and node_modules/ directories in the client bundle (so that it doesn't become too large). I've also removed the client/CNAME and client/LICENSE files. The CNAME file is no longer needed: it was only used for GH pages, which I'd like to try moving away from. The license for the client code is covered by the LICENSE file at the repo root - LICENSE and client/LICENSE are the same, except that the client/LICENSE file has the copyright years listed as 2013-16, so it is redundant.
1 parent 4a9c84d commit dbc4ca5

24 files changed

+124
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ cabal.sandbox.config
1313
*.chi
1414
*.chs.h
1515
*.lksh*
16+
bundle/

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@ notifications:
3030
email: true
3131

3232
before_deploy:
33-
- mkdir bundle
34-
- cp `stack path --dist-dir`/build/trypurescript/trypurescript bundle/
35-
- cp LICENSE bundle/
36-
- tar czf trypurescript.tar.gz -C bundle/ .
33+
./ci/before_deploy.sh
3734

3835
deploy:
3936
provider: releases
4037
api_key: $RELEASE_KEY
41-
file: trypurescript.tar.gz
38+
file: trypurescript-$COMPONENT.tar.gz
4239
skip_cleanup: true
4340
on:
4441
tags: true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ npm install
5050
npm run build
5151
npm run bundle
5252

53+
cd public
5354
httpserver 8080 #eg with: alias httpserver='python -m SimpleHTTPServer'
5455
open http://localhost:8080
5556
```

ci/before_deploy.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /usr/bin/env bash
2+
3+
set -ex
4+
5+
case $COMPONENT in
6+
server)
7+
mkdir bundle
8+
cp $(stack path --dist-dir)/build/trypurescript/trypurescript bundle/
9+
cp LICENSE bundle/
10+
cp -r deploy/ bundle/
11+
cp -r staging/ bundle/
12+
tar czf trypurescript-server.tar.gz -C bundle/ .
13+
;;
14+
client)
15+
mkdir bundle
16+
cp LICENSE bundle/
17+
cp -r client/public/ bundle/
18+
tar czf trypurescript-client.tar.gz -C bundle/ .
19+
;;
20+
*)
21+
echo >&2 "Unrecognised component: $COMPONENT"
22+
exit 1
23+
;;
24+
esac

client/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
/.purs*
77
/.psa*
88
/.stack*
9-
/js/index.js
9+
/public/js/index.js
1010
.spago/

client/CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

client/LICENSE

Lines changed: 0 additions & 12 deletions
This file was deleted.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"scripts": {
44
"clean": "rimraf output",
55
"build": "spago build --purs-args '--censor-lib --strict'",
6-
"bundle": "spago bundle-app --to js/index.js"
6+
"bundle": "spago bundle-app --to public/js/index.js"
77
},
88
"devDependencies": {
99
"purescript": "^0.13.6",
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)