npm install -g dator follow these instructions.
cdinto your website's directory and run
dat share. This will create a .dat folder in the directory and seed the directory's files.
Now, as long as your computer is on, your website will now be accessible from any computer via the beaker browser.
Now, we'll set up a $5/month DigitalOcean droplet to seed your files from, so that even when your personal computer is off, the website will be accessible. We'll also mirror it over https so that the site can be accessed with any modern web browser.
To connect your public domain (i.e. dillon.dev) to this droplet, you can either point the domain to the IP address or point the domain's nameservers to DigitalOcean and let DigitalOcean handle it. I decided to do the latter, which I'll explain below or you can follow these instructions.
Arecords: one with hostname
@that will direct to your droplet's IP address (click it in the dropdown or type it in manually) TTL
3600; another one with hostname
wwwthat will direct to your droplet's IP address and TTL
3600. The result will look something like this:
These changes can take up to three days to take effect. They took overnight for me.
ssh root@IPwhere IP is your droplet's IP address. (So if your IP address was 188.8.131.52 you'd run
yes. You should now have root access to your Ubuntu droplet and may see an Ubuntu welcome screen. Your terminal will say root@name-of-your-droplet, and commands run in this terminal shell will now be run on your droplet.
ufw allow proto tcp from any to any port 80,443,3282
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install node
npm install -g @beaker/homebase
npm install -g pm2
Create a folder in your directory titled
.well-known and add in it a file named
dat with your raw dat address on the first line, and
TTL=3600 on the second line. For example, this is this website's
Follow my instructions below or check these instructions on the official homebase repo.
urlof your dat (which is seeding from your own computer), the name of the
domainyou'd like to mirror to, and an
directory: ~/.homebase # where your data will be stored httpMirror: true # enables HTTP mirroring ports: http: 80 # HTTP port for redirects or non-TLS serving https: 443 # HTTPS port for serving mirrored content and DNS data letsencrypt: # set to false to disable Let's Encrypt email: "firstname.lastname@example.org" # provide your email to Let's Encrypt agreeTos: true # you must agree to the LE terms (set to true) dashboard: # set to false to disable port: 8089 # port for accessing the metrics dashboard # enter your pinned dats here dats: - url: dat://6d592b82418d8b9fbb4f9c79e97cc3711649ee7abb84f6359e54e02b3b3df047 # URL of the dat to be pinned domains: - dillon.dev # (optional) the domains of the dat
enterto confirm overwrite. Then exit with
Make sure that you are still seeding your website with
dat share from your own computer (as instructed in the very
first step in this document), otherwise the droplet won't have access to
homebase. You should see something like this:
If an error occurs that you don't understand, consult the Troubleshooting section of homebase's official docs
If it works, stop it with
ctrl-C and daemonize it with
pm2 by running
pm2 start homebase. You should see
something like this:
(optional) see more information about the pm2 daemon with
pm2 show 0 and
pm2 logs. If you need to
stop the process for any reason, run
pm2 stop homebase.
You can now close all terminal shells, including the one seeding dat from your own computer, and the one connected to your droplet.
Your website should now be seeding to https and dat (
dat://dillon.dev) but it may take up to three days
for your DNS records to change.
Once your DNS records are changed, you can
cd into your
website's directory and run
dat share at any time to
instantly update your website.
Take care that a hidden .dat folder and a dat.json file live in your website's directory. Make sure to keep these with your files.