Please note that by hosting your site statically with a service like Vercel or Netlify, you can't access the Control Panel in production and are not able to use dynamic features like Statamic's built-in forms or random sorting in your templates.
Deployments are triggered by committing to Git and pushing to GitHub.
- Create a new file
build.sh
file in your project and paste from the example code snippet below - Run
chmod +x build.sh
on your terminal to make sure the file can be executed when deploying - Import a new site in your Vercel account
- Link the site to your desired GitHub repository
- Set build command to
./build.sh
- Set output directory to
storage/app/static
- Add
APP_KEY
env variable, by runningphp artisan key:generate
locally, and copying from your.env
- ie.
APP_KEY
your-app-key-value
- ie.
- Add
APP_URL
environment variable after your site has a configured domain- ie.
APP_URL
https://thats-numberwang-47392.vercel.app
- ie.
Example Build Script
Add the following snippet to build.sh
file to install PHP, Composer, and run the ssg:generate
command:
#!/bin/sh # Install PHP & WGETdnf clean metadatadnf install -y php8.2 php8.2-{common,mbstring,gd,bcmath,xml,fpm,intl,zip}dnf install -y wget # INSTALL COMPOSEREXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]then >&2 echo 'ERROR: Invalid installer checksum' rm composer-setup.php exit 1fi php composer-setup.php --quietrm composer-setup.php # INSTALL COMPOSER DEPENDENCIESphp composer.phar install # GENERATE APP KEYphp artisan key:generate # BUILD STATIC SITEphp please stache:warm -n -qphp please ssg:generate