Skip to content

Instantly share code, notes, and snippets.

View wesort's full-sized avatar

Ben Edmonds wesort

View GitHub Profile
@wesort
wesort / lifecycle.xml
Created February 27, 2024 14:33
Example for applying expiration policy on Digitalocean Spaces
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>Prune files starting with backup- after 1 days</ID>
<Prefix>assets/backup-</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>1</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
@wesort
wesort / nginx.conf
Created March 16, 2023 15:09
nginx location / { ... } for Nuxt
location / {
proxy_pass http://localhost:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
@wesort
wesort / s3cmd.md
Last active December 8, 2022 15:32

s3cmd

A command line tool for syncing with DigitalOcean Spaces or Amazon S3

I'm using this in the context of .gitignore'ing Assets from a Statamic site.

DigitalOcean Spaces with s3cmd

Install & configure

s3cmd setup

  • Install s3cmd to interact with Spaces

Deployment

Creating and configuring a new site / environment occurs occasionally. Often, to update the underlying server software.

This site has been built with:

@wesort
wesort / refresh.sh
Created September 20, 2022 10:59
Refresh utility for Statamic v3
php artisan cache:clear # Clear the Laravel application cache.
php artisan config:cache # Clear and refresh the Laravel config cache.
php artisan route:cache # Clear and refresh the Laravel route cache.
php artisan statamic:stache:warm # Warm the Statamic stache.
php artisan statamic:search:update --all # Update the search index.
php artisan statamic:static:clear # Clear the Statamic static cache (if you use this).
#php artisan statamic:static:warm --queue # Warm the Statamic static cache (if you use this).
echo 'warming /work ...'
curl -# https://example.com/large-page > /dev/null
echo '/work is warmed.'
@wesort
wesort / statamic-v3-nginx.conf
Last active September 20, 2022 10:57
nginx.conf adjustments for Statamic deployed to Digitalocean using Laravel Forge
# Replace location / {...} with this:
location / {
try_files /static${uri}_${args}.html $uri /index.php?$args;
}
# Add to bottom just before closing `}`:
# Enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
@wesort
wesort / .gitignore
Created December 12, 2019 16:01
.gitignore for Statamic v2
# Things for git to not bother with
#
# To avoid dev code being indexed #
robots.txt
#
# OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
@wesort
wesort / dev.env
Last active December 12, 2019 15:57
Environment file for a development website running Statamic v2
APP_ENV=dev
SITE_URL=https://dev.example.co.uk
STACHE_ALWAYS_UPDATE=true
STATIC_CACHING_ENABLED=false
@wesort
wesort / live.env
Created December 12, 2019 15:46
Environment file for a production website running Statamic v2
APP_ENV=production
SITE_URL=https://example.co.uk
STACHE_ALWAYS_UPDATE=true
STATIC_CACHING_ENABLED=false
DEBUG=false
DEBUG_BAR=false
@wesort
wesort / dev.robots.txt
Last active December 12, 2019 15:40
A sample robots.txt file for a development site
# robotstxt.org/
User-agent: *
Disallow: /
# Allow Twitter access for validation testing
# https://cards-dev.twitter.com/validator
User-agent: Twitterbot
Disallow: