PurpleTurtleCreative / website

Official WordPress website of Purple Turtle Creative.
https://purpleturtlecreative.com/
1 stars 0 forks source link

Implement GitHub Action continuous deployment #4

Closed MichelleBlanchette closed 2 years ago

MichelleBlanchette commented 2 years ago

Checking the disk usage...

du -a /var/www/html | sort -n -r | head -n 10

... I can see that git is taking up the most space:

347812  /var/www/html
196492  /var/www/html/.git
185932  /var/www/html/.git/objects
147856  /var/www/html/.git/objects/pack
100388  /var/www/html/wp-content
78956   /var/www/html/wp-content/plugins
44740   /var/www/html/.git/objects/pack/pack-00cacff83aa2ac8cfb914b0c5d28b49079cc2b97.pack
40936   /var/www/html/wp-includes
36224   /var/www/html/.git/objects/pack/pack-352d915128a95dbf6e58cb472bc1d1624a2a74e9.pack
22632   /var/www/html/wp-includes/js

Also, the submodule checkouts are often confusing because I hardly ever do them.

And it'd definitely be a good learning experience to use GitHub Actions and automate my deployments!!

MichelleBlanchette commented 2 years ago

https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions

MichelleBlanchette commented 2 years ago

Deployment Steps

Trigger Events

To start, let's use the manual dispatch event: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#manual-events

MichelleBlanchette commented 2 years ago

rsync

To avoid the chown and chmod commands needing to be ran... Could try using rsync --owner --group as specified in the manual page: https://linux.die.net/man/1/rsync

I'm not quite sure how this works, but it sounds like you'd chown -R www-data:www-data on the GitHub Actions machine, and then use the rsync options to maintain the owner and group as the code is synced over to its destination.

MichelleBlanchette commented 2 years ago

I have confirmed a fully successful deployment. This is awesome. 😎

MichelleBlanchette commented 2 years ago

By the way, top disk usage is now this:

148500  /var/www/html
97576   /var/www/html/wp-content
77556   /var/www/html/wp-content/plugins
40936   /var/www/html/wp-includes
22632   /var/www/html/wp-includes/js
16784   /var/www/html/wp-content/plugins/wordpress-seo
15360   /var/www/html/wp-content/plugins/wordfence
13120   /var/www/html/wp-content/plugins/post-smtp
12912   /var/www/html/wp-content/plugins/wp-rocket
12804   /var/www/html/wp-content/uploads