Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ cabal.sandbox.config
*.chi
*.chs.h
*.lksh*
bundle/
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ notifications:
email: true

before_deploy:
- mkdir bundle
- cp `stack path --dist-dir`/build/trypurescript/trypurescript bundle/
- cp LICENSE bundle/
- tar czf trypurescript.tar.gz -C bundle/ .
./ci/before_deploy.sh

deploy:
provider: releases
api_key: $RELEASE_KEY
file: trypurescript.tar.gz
file: trypurescript-$COMPONENT.tar.gz
skip_cleanup: true
on:
tags: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ npm install
npm run build
npm run bundle

cd public
httpserver 8080 #eg with: alias httpserver='python -m SimpleHTTPServer'
open http://localhost:8080
```
Expand Down
24 changes: 24 additions & 0 deletions ci/before_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /usr/bin/env bash

set -ex

case $COMPONENT in
server)
mkdir bundle
cp $(stack path --dist-dir)/build/trypurescript/trypurescript bundle/
cp LICENSE bundle/
cp -r deploy/ bundle/
cp -r staging/ bundle/
tar czf trypurescript-server.tar.gz -C bundle/ .
;;
client)
mkdir bundle
cp LICENSE bundle/
cp -r client/public/ bundle/
tar czf trypurescript-client.tar.gz -C bundle/ .
;;
*)
echo >&2 "Unrecognised component: $COMPONENT"
exit 1
;;
esac
2 changes: 1 addition & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
/.purs*
/.psa*
/.stack*
/js/index.js
/public/js/index.js
.spago/
1 change: 0 additions & 1 deletion client/CNAME

This file was deleted.

12 changes: 0 additions & 12 deletions client/LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"scripts": {
"clean": "rimraf output",
"build": "spago build --purs-args '--censor-lib --strict'",
"bundle": "spago bundle-app --to js/index.js"
"bundle": "spago bundle-app --to public/js/index.js"
},
"devDependencies": {
"purescript": "^0.13.6",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
78 changes: 78 additions & 0 deletions deploy/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

server {
listen 80 default_server;
listen [::]:80 default_server;

return 301 https://$host$request_uri;
}

server {
server_name try.purescript.org;

listen 443 ssl http2;
listen [::]:443 ssl http2;

# SSL configuration
# based on https://ssl-config.mozilla.org/
ssl_certificate /etc/letsencrypt/live/try.purescript.org/fullchain.pem;
ssl_trusted_certificate /etc/letsencrypt/live/try.purescript.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/try.purescript.org/privkey.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:ssl:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
ssl_dhparam /etc/nginx/ssl_dhparam;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;

# HSTS
# Maybe enable this later
# Low max-age to start with, just in case
# add_header Strict-Transport-Security "max-age=60" always;

#
# try.purescript.org specific things
#

location / {
root /var/www/trypurescript/public;
}

}

server {
server_name compile.purescript.org;

listen 443 ssl http2;
listen [::]:443 ssl http2;

# SSL configuration
# based on https://ssl-config.mozilla.org/
ssl_certificate /etc/letsencrypt/live/try.purescript.org/fullchain.pem;
ssl_trusted_certificate /etc/letsencrypt/live/try.purescript.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/try.purescript.org/privkey.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:ssl:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
ssl_dhparam /etc/nginx/ssl_dhparam;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;

# HSTS
# Maybe enable this later
# Low max-age to start with, just in case
# add_header Strict-Transport-Security "max-age=60" always;

#
# compile.purescript.org specific things
#

location / {
proxy_pass http://127.0.0.1:8081;
}
}
3 changes: 3 additions & 0 deletions deploy/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /usr/bin/env/bash

exec trypurescript +RTS -N1 -A128m -M750M -RTS 8081 $(spago sources)
13 changes: 13 additions & 0 deletions deploy/trypurescript.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Web service for Try PureScript

[Service]
Type=simple
User=www-data
ExecStart=/var/www/trypurescript/deploy/start
WorkingDirectory=/var/www/trypurescript/staging
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target