Skip to content

Commit c390933

Browse files
committed
staging
1 parent 4b54be0 commit c390933

File tree

6 files changed

+17
-36
lines changed

6 files changed

+17
-36
lines changed

deploy-server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212
rm -rf build
1313
./gradlew build
1414

15-
remote=root@attestation.app
15+
remote=root@staging.attestation.app
1616
path=/opt/attestation
1717
active=$(ssh $remote readlink $path/deploy)
1818

deploy-static

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ fi
1212

1313
./process-static $fd
1414

15-
remote=root@attestation.app
15+
remote=root@staging.attestation.app
1616

1717
# use last modified timestamps from attestation.app
18-
rsync -rptcv --chmod=D755,F644 --delete --fsync --preallocate $remote:/srv/attestation.app/ static-production
19-
rsync -pcv --chmod=D755,F644 --fsync --preallocate static-production/sitemap.xml{,.gz,.br} static-tmp/
20-
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate static-tmp/ static-production
21-
for f in static-production/**.*(br|gz); do
18+
rsync -rptcv --chmod=D755,F644 --delete --fsync --preallocate $remote:/srv/attestation.app/ static-staging
19+
rsync -pcv --chmod=D755,F644 --fsync --preallocate static-staging/sitemap.xml{,.gz,.br} static-tmp/
20+
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate static-tmp/ static-staging
21+
for f in static-staging/**.*(br|gz); do
2222
touch -r "${f%.*}" "$f"
2323
done
2424
changed="$(./generate-sitemap)"
2525
xmllint --noblanks static-tmp/sitemap.xml --output static-tmp/sitemap.xml
2626
brotli -f static-tmp/sitemap.xml
2727
zopfli static-tmp/sitemap.xml
28-
rsync -pcv --chmod=D755,F644 --fsync --preallocate static-tmp/sitemap.xml{,.gz,.br} static-production/
28+
rsync -pcv --chmod=D755,F644 --fsync --preallocate static-tmp/sitemap.xml{,.gz,.br} static-staging/
2929

3030
active=$(ssh $remote readlink /srv/attestation.app)
3131

@@ -40,7 +40,7 @@ echo target is $target
4040
echo
4141

4242
ssh $remote "rm -rf $target && cp -a $active $target"
43-
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate static-production/ $remote:$target
43+
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate static-staging/ $remote:$target
4444
ssh $remote "ln -snf $target /srv/attestation.app && sync /srv/attestation.app"
4545

4646
echo "root $target;" > nginx-tmp/root_attestation.app.conf
@@ -55,8 +55,3 @@ ssh $remote 'id -u attestation &>/dev/null || useradd -r attestation -md /var/li
5555
rsync -pcv --chmod=755 --fsync --preallocate remote-backup $remote:/usr/local/bin/
5656
rsync -pcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.timer $remote:/etc/systemd/system/remote-backup.timer
5757
rsync -pcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.service $remote:/etc/systemd/system/remote-backup.service
58-
rsync -pcv --chmod=644 --chown attestation:attestation --fsync --preallocate backup-public-key.txt cloud-archive.sh $remote:/var/lib/attestation/
59-
60-
if [[ -n "$changed" ]]; then
61-
./indexnow <<< "$changed"
62-
fi

generate-sitemap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ entries = []
2525
for page in pages:
2626
path = page[0]
2727
loc = base + path
28-
filepath = "static-production" + path
28+
filepath = "static-staging" + path
2929
if path[-1] == '/':
3030
filepath += "index.html"
3131
elif "." not in path:

nginx/nginx.conf

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ http {
6868
ssl_prefer_server_ciphers on;
6969
ssl_conf_command Options PrioritizeChaCha;
7070

71-
ssl_certificate /etc/letsencrypt/live/attestation.app/fullchain.pem;
72-
ssl_certificate_key /etc/letsencrypt/live/attestation.app/privkey.pem;
71+
ssl_certificate /etc/letsencrypt/live/staging.attestation.app/fullchain.pem;
72+
ssl_certificate_key /etc/letsencrypt/live/staging.attestation.app/privkey.pem;
7373

7474
# maintained by rotate-session-ticket-keys in noswap tmpfs
7575
ssl_session_ticket_key /etc/tls/session-ticket-keys/4.key;
@@ -117,7 +117,7 @@ http {
117117
server {
118118
listen 80;
119119
listen [::]:80;
120-
server_name attestation.app www.attestation.app;
120+
server_name staging.attestation.app;
121121

122122
location /.well-known/acme-challenge/ {
123123
root /srv/certbot;
@@ -144,24 +144,7 @@ http {
144144
listen 443 ssl;
145145
listen [::]:443 ssl;
146146
http2 on;
147-
server_name www.attestation.app;
148-
149-
keepalive_timeout 3m;
150-
151-
include snippets/security-headers.conf;
152-
add_header Cross-Origin-Resource-Policy "same-origin" always;
153-
154-
# https://trac.nginx.org/nginx/ticket/2012
155-
location / {
156-
return 301 https://attestation.app$request_uri;
157-
}
158-
}
159-
160-
server {
161-
listen 443 ssl;
162-
listen [::]:443 ssl;
163-
http2 on;
164-
server_name attestation.app;
147+
server_name staging.attestation.app;
165148

166149
include root_attestation.app.conf;
167150
error_page 403 =404 /404;

nginx/snippets/security-headers.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# staging site (not a security header)
2+
add_header X-Robots-Tag "noindex" always;
3+
14
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
25
add_header X-Content-Type-Options "nosniff" always;
36
# Firefox applies Referrer-Policy to the Origin header

src/main/java/app/attestation/server/AttestationServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class AttestationServer {
8686
private static final int HISTORY_PER_PAGE = 20;
8787
private static final long MMAP_SIZE = 1024 * 1024 * 1024;
8888

89-
static final String DOMAIN = "attestation.app";
89+
static final String DOMAIN = "staging.attestation.app";
9090
private static final String ORIGIN = "https://" + DOMAIN;
9191

9292
private static final long POST_START_DELAY_MS = 1000;

0 commit comments

Comments
 (0)