Deployment of html5 base
by Ty Myrddin
Published on January 8, 2022
The path we took to practice setting up deployment to Digital Ocean:
HTML5 Boilerplate
- Download latest boilerplate
- Add latest bootstrap
- Add some code to
index.html
- Add
styles.css
- Check result in browser by loading the
index.html
- Create repository in Bitbucket
- Push boilerplate+ code to repository using
git
DigitalOcean droplet
- Set up a minimal Ubuntu 20.04 droplet on Digital Ocean
- Create a non-root user
- Grant administrative privileges to non-root user
- Install and enable firewall and allow for
ssh
- Enable external access for regular user
ssh
into droplet as regular user
- Update and upgrade
- Install Nginx
- Adjust firewall to allow
http
- Checking web server is active and running
- Check web server is reachable over IP address
- Get a domainname and set up digitalocean NS nameservers at registrar
- Add the domain in the Digital Ocean Networking section’s Domains tab
- Add
A
records for domainname
and www.domainname
- Set up server blocks in Nginx
- Check web server is reachable over
http://domainname
- Install certbot
- Confirm Nginx configuration for certbot finding the correct server block
- Allow HTTPS through the firewall
- Obtain an SSL certificate
- Verify certbot auto-renewal
- Check web server is reachable over
https://chosendomainname
Pipeline on bitbucket
ssh
ssh
into droplet as regular userhttp
A
records for domainname
and www.domainname
http://domainname
https://chosendomainname
Use Bitbucket validator.
- Enable pipeline for the repository in Bitbucket
- Create "Hello World" pipeline
pipelines:
branches:
default:
- step:
name: Just a simple echo!
script:
- echo "Hello world!"
- Create new branch
artifacts
- Create server (IP address droplet) and user (droplet user) variables in Bitbucket pipelines
- Create SSH keys in Bitbucket pipelines
- Add public key to
authorized_keys
in droplet - Verify fingerprint
- Create a
dist
folder and exlude it from the remote repo in.gitignore
- Create
artifacts
pipeline to SCP the boilerplate to server - Deploy using SCP
pipelines:
branches:
default:
- step:
name: Just a simple echo!
script:
- echo "Hello world!"
artifacts:
- step:
name: Build process
script:
- rsync -av --progress . dist --exclude dist
artifacts:
- dist/**
- step:
name: Deploy artifacts to production server using SCP
script:
- pipe: atlassian/scp-deploy:0.3.4
variables:
USER: $USER
SERVER: $SERVER
REMOTE_PATH: '/var/www/tymyrddin.rocks/html/'
LOCAL_PATH: 'dist/*'
- Create new branch
artifacts
- Create server (IP address droplet) and user (droplet user) variables in Bitbucket pipelines
- Create SSH keys in Bitbucket pipelines
- Add public key to
authorized_keys
in droplet - Verify fingerprint
- Create a
dist
folder and exlude it from the remote repo in.gitignore
- Create
artifacts
pipeline to SCP the boilerplate to server - Deploy using SCP
That's it. Got it running, then destroyed it. Find the completed code in the html5-base repo
WHERE'S MY COW?! Wyrd Sisters