- wordpress 18.04 marketplace droplet
- submit an ssh key
ssh-keygen -t rsa
- once droplet is created, create A record to point at the droplet's IP
- ssh into
ssh root@YOURIP
to set root password/finish install- includes LetsEncrypt, for later SSL, run
certbot --apache -d YOURDOMAIN.com -d www.YOURDOMAIN.com
- includes LetsEncrypt, for later SSL, run
Digital Ocean outlines how to set up a git hook here.
TL;DR:
- ssh into your droplet
- without changing directories:
sudo chown -R `whoami`:`id -gn` /var/www/html
- then:
mkdir ~/proj
,cd ~/proj
,git init --bare
to create a bare git-dir - create/open your post-receive file:
nano hooks/post-receive
inside:
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/var/www/html/PATH/TO/THEDIRECTORY-YOU-WANT-TO-PUSH-TO --git-dir=/ROOT/proj checkout -f
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
- your
PATH/TO/THEDIRECTORY-YOU-WANT-TO-PUSH-TO
should be an empty directory - save and close this file, then run
chmod +x hooks/post-receive
to make script executable - logout of your ssh, and
git remote add production ROOT@YOURIPADDRESS:proj
.
- https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
- https://marketplace.digitalocean.com/apps/wordpress
- are.na/lukas-eigler-harding/learning-wordpress-build