Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site refactor #52

Merged
merged 52 commits into from
Jun 24, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
30fa35d
Move html to content
olizilla Jun 12, 2017
93bb728
Fix head.html partial
olizilla Jun 12, 2017
f539b31
Browserify the JS.
olizilla Jun 12, 2017
5fc4750
Pull src JS to top level. Fix html script links
olizilla Jun 13, 2017
ad38972
Modularise the JS
olizilla Jun 13, 2017
4e59cc8
Add generated js to .gitignore
olizilla Jun 13, 2017
d962edf
Pull the topbar into a partial
olizilla Jun 13, 2017
5d21980
Merge pull request #1 from tableflip/browserify
olizilla Jun 13, 2017
5f95647
Merge pull request #3 from tableflip/topbar-partial
olizilla Jun 13, 2017
56ff92f
Pulls implementation table into partial
olizilla Jun 13, 2017
48f5635
WIP Builds impls html from data
olizilla Jun 14, 2017
d83b79f
Impls page works as before, with content created at build time.
olizilla Jun 14, 2017
df5ee56
Fix homepage animation
olizilla Jun 14, 2017
2e2e4c2
Remove debug code
olizilla Jun 14, 2017
963d50c
Merge pull request #4 from tableflip/data-driven-impls
olizilla Jun 14, 2017
fe26e56
Refactor bundles.json
olizilla Jun 14, 2017
8f4bc30
Data driven bundles page
olizilla Jun 15, 2017
1d07ffb
Merge pull request #5 from tableflip/data-driven-bundles
olizilla Jun 15, 2017
f940f09
Fix line endings in .less files
olizilla Jun 15, 2017
305b59f
Remove generated css
olizilla Jun 15, 2017
6af1ff4
Fix less imports. Add `build:css` target
olizilla Jun 15, 2017
4f9645f
Merge pull request #6 from tableflip/css-build-process
olizilla Jun 15, 2017
ed3f95d
Port impls section on homepage to hugo
olizilla Jun 15, 2017
bc7a76d
Merge pull request #7 from tableflip/fix-impls-on-homepage
olizilla Jun 15, 2017
990e505
WIP on converting splash to css
olizilla Jun 15, 2017
f890e34
WIP
olizilla Jun 15, 2017
3c5e2a7
WIP on splash... it lives!
olizilla Jun 16, 2017
11df3d1
Staggared fadez
olizilla Jun 16, 2017
02d90ea
WIP on headline animation
olizilla Jun 19, 2017
a278814
Use new css only splash animation.
olizilla Jun 19, 2017
09af244
Remove splash impl research notes
olizilla Jun 19, 2017
c490005
Merge pull request #8 from tableflip/splash
olizilla Jun 19, 2017
c186a77
Pull in contributors data at build time
olizilla Jun 20, 2017
dca419e
Fix pause on hover. Remove unused less.
olizilla Jun 20, 2017
8e3bb00
WIP on build process
olizilla Jun 20, 2017
3b9e9a0
Remove unused css, add onerror handler for missing images
olizilla Jun 20, 2017
fdaa741
Merge pull request #9 from tableflip/contributors
olizilla Jun 20, 2017
992a86f
Add minify steps
olizilla Jun 21, 2017
9d2aec9
build step to create prod site
olizilla Jun 21, 2017
e653237
Merge remote-tracking branch 'origin/move-content' into build-process
olizilla Jun 21, 2017
5fffc3b
Fix peer-routing.svg casing
olizilla Jun 21, 2017
8f097ec
Makefile based dev is GO!
olizilla Jun 21, 2017
cbd9c1c
Merge remote-tracking branch 'origin/move-content' into build-process
olizilla Jun 21, 2017
7d1a31a
make dev-stop sounds better
olizilla Jun 21, 2017
1b116e0
Pull README up to spec
olizilla Jun 21, 2017
1c2a6de
Add versions dir
olizilla Jun 21, 2017
eec7cf9
Merge pull request #10 from tableflip/build-process
olizilla Jun 21, 2017
33daf62
Fix publish-to-domain to use dnslink script
olizilla Jun 22, 2017
a35b96b
Require DOMAIN as explicit arg
olizilla Jun 22, 2017
d9ca2a4
Merge pull request #11 from tableflip/dnslink
olizilla Jun 22, 2017
68b36ad
Speed up contributor image loading
olizilla Jun 22, 2017
d7a5894
Decrease contributor loading delay to 50ms
olizilla Jun 22, 2017
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 @@ -4,3 +4,4 @@ public
static/js/*.js
static/css/*.css
dev.pid
auth.token
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
DNSZONE="libp2p.io"
DNSRECORD="@"
DOMAIN="libp2p.io"
IPFSLOCAL="http://localhost:8080/ipfs/"
IPFSGATEWAY="https://ipfs.io/ipfs/"
NPM?=npm
NPMBIN=./node_modules/.bin
NPM=npm
OUTPUTDIR=public
PIDFILE=dev.pid

Expand All @@ -25,7 +24,7 @@ help:
@echo ' make dev Start a hot-reloding dev server on http://localhost:1313 '
@echo ' make dev-stop Stop the dev server '
@echo ' make deploy Add the website to your local IPFS node '
@echo ' make publish-to-domain Update $(DNSZONE) DNS record to the ipfs hash from the last deploy '
@echo ' make publish-to-domain Update $(DOMAIN) DNS record to the ipfs hash from the last deploy '
@echo ' make clean remove the generated files '
@echo ' '

Expand Down Expand Up @@ -80,9 +79,9 @@ deploy:
echo "- ipfs pin add -r /ipfs/$$hash"; \
echo "- make publish-to-domain"; \

publish-to-domain: install auth.token
DIGITAL_OCEAN=$(shell cat auth.token) $(NPMBIN)/dnslink-deploy \
--domain=$(DNSZONE) --record=$(DNSRECORD) --path=/ipfs/$(shell cat versions/current)
publish-to-domain: auth.token versions/current
DNSIMPLE_TOKEN=$(shell cat auth.token) \
./dnslink.sh $(DOMAIN) $(shell cat versions/current)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgierth will like this :D

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually let's move the token file to something like $HOME/.protocol/dnsimple.token -- just so it's never underneath the repo directory and there's no chance of ever accidentally committing it.

You can just assume that people put it there out-of-band (dnslink.sh will fail on its own).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgierth will move this as a separate issue and for a future sprint since last sprint ran out of time.


clean:
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) && \
Expand Down
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ git clone https://github.com/libp2p/website

## Usage

To deploy the site libp2p.io, run:

```sh
# Build out the optimised site to ./public, where you can check it locally.
make

# Add the site to your local ipfs, you can check it via /ipfs/<hash>
make deploy

# Save your dnsimple api token as auth.token
cat "<api token here>" > auth.token

# Update the dns record for libp2p to point to the new ipfs hash.
make publish-to-domain
```

The following commands are available:

### `make`
Expand All @@ -46,10 +62,15 @@ Optimise all the things!

Build the site in the `public` dir and add to `ipfs` _(requires `hugo` & `ipfs` on your `PATH`)_

### `make publish-to-domain`
### `make publish-to-domain` :rocket:

Update the DNS record for `libp2p.io`. _(requires an `auto.token` file to be saved in the project root.)_

If you'd like to update the dnslink TXT record for another domain, pass `DOMAIN=<your domain here>` like so:

Update the DNS record for libp2p.io. _(requires an `auto.token` file to be saved in the project root.)_
:rocket:
```sh
make publish-to-domain DOMAIN=tableflip.io
```

---

Expand All @@ -59,6 +80,7 @@ See the `Makefile` for the full list or run `make help` in the project root.

* `hugo` to build website
* `ipfs` to deploy changes
* `jq`, `curl` and an `auth.token` file in the project root containing your dnsimple api token to update the dns.

All other dependencies are pulled from `npm` and the Makefile will run `npm install` for you because it's nice like that.

Expand Down
53 changes: 53 additions & 0 deletions dnslink.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

#
# Usage:
# DNSIMPLE_TOKEN=<token> ./dnslink.sh <domain> <hash>
#
# Example:
# DNSIMPLE_TOKEN=trustno1 ./dnslink.sh website.protocol.ai Qmfoobar
#
# Dependencies:
# - bash
# - curl
# - jq
#
# From:
# https://raw.githubusercontent.com/ipfs/infrastructure/master/scripts/dnslink.sh
#

set -e

ZONE="$1"
HASH="$2"

([ ! -z "$DNSIMPLE_TOKEN" ] && [ ! -z "$ZONE" ] && [ ! -z "$HASH" ]) \
|| (echo "Usage: DNSIMPLE_TOKEN=<token> ./dnslink.sh <domain> <hash>" && exit 1)

RECORD_NAME="_dnslink"
RECORD_TTL=120

record_id=$(
curl -s "https://api.dnsimple.com/v1/domains/$ZONE/records?name=$RECORD_NAME&type=TXT" \
-H "X-DNSimple-Domain-Token: $DNSIMPLE_TOKEN" \
-H "Accept: application/json" \
| jq -r '.[].record.id'
)

if [ -z "$record_id" ]; then
curl -v -s -X POST "https://api.dnsimple.com/v1/domains/$ZONE/records" \
-H "X-DNSimple-Domain-Token: $DNSIMPLE_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d "{\"record\":{ \"name\":\"$RECORD_NAME\", \"record_type\":\"TXT\", \"content\":\"dnslink=/ipfs/$HASH\", \"ttl\":\"$RECORD_TTL\" }}" \
| jq -r '.record' \
&& printf "\\nIt looks like we're good: https://ipfs.io/ipns/$ZONE\\n"
else
curl -v -s -X PUT "https://api.dnsimple.com/v1/domains/$ZONE/records/$record_id" \
-H "X-DNSimple-Domain-Token: $DNSIMPLE_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d "{\"record\":{ \"content\":\"dnslink=/ipfs/$HASH\", \"name\":\"$RECORD_NAME\", \"ttl\":\"$RECORD_TTL\" }}" \
| jq -r '.record' \
&& printf "\\nIt looks like we're good: https://ipfs.io/ipns/$ZONE\\n"
fi
1 change: 0 additions & 1 deletion versions/current

This file was deleted.