Go to file
tobias 8fdfb2fbe4
All checks were successful
continuous-integration/drone/push Build is passing
Check if dev script is stopping build (??)
2024-05-24 09:10:43 +02:00
astro Type posts 2024-05-21 12:04:23 +02:00
payload Move payload types to within payload 2024-05-22 09:21:31 +02:00
.drone.yml Fix YAML syntax 2024-05-20 23:33:07 -03:00
.env.sample Further local dev tidying 2024-05-18 14:45:00 -03:00
.gitignore Try to make build work 2024-05-22 09:13:09 +02:00
docker-compose.prod.yml Make sure DRONE_URL is set for Payload? 2024-05-19 14:24:48 -03:00
docker-compose.yml Ensure we build -dev container locally 2024-05-19 13:41:14 -03:00
LICENSE Initial commit 2024-05-17 22:32:32 +00:00
package.json Check if dev script is stopping build (??) 2024-05-24 09:10:43 +02:00
README.md Fix YAML syntax error 2024-05-19 19:19:41 -03:00
tsconfig.json Initial commit 2024-05-17 22:32:32 +00:00

Paystro

Paystro is a pre-configured setup for Astro and Payloadcms, designed to make it easy for you to start building your website. With Paystro, you'll have a complete development environment that you can run locally using Docker. This setup simplifies the testing and development of your website before deploying it to a production environment.

Architecture

Paystro is a fork of Astroad.

Unlike Astroad where the "Astro" image is the built static site served with Nginx Paystro's Astro image is a builder image.

In Paystro, the Docker stack just contains Payload and a generic Nginx container.

How to use this template

  1. Create a new Gitea repository based on this template repo (choose at least "git content")
  2. Edit .env.sample to define the project name
  3. Remove this notice (everything down to the ---)

To set up deployment:

  1. Make sure the server you want to deploy to is set up for Drone access, including adding an SSH key as an organisational secret for the organisation this project is in (see Autonomic internal docs)
  2. Edit .drone.yml to set variables:
    • HOST: hostname or IP address of the server to deploy to (e.g. vps.example.tld)
    • DOMAIN: domain name of the live site (e.g. site.example.tld)
    • STACK_NAME: the Docker stack name, usually $DOMAIN with dots replaced with underscores (e.g. site_example_tld)
    • DRONE_URL: root URL for the Drone instance (e.g. https://drone.example.tld)
  3. Make sure that DNS records for $DOMAIN and admin.$DOMAIN, pointing to $HOST, are defined.
  4. Generate secrets (openssl rand -hex 32 works well) for PAYLOAD_SECRET and MONGO_PASSWORD. Insert the personal user token for a Drone bot user (e.g. autono-bot) as TOKEN). For all of them, use something like echo "foobar" | docker secret create paystro_swarm-demo_autonomic_zone_token_v1 -, where paystro_swarm-demo_autonomic_zone is the STACK_NAME.
  5. Activate the repo in Drone

${REPO_NAME}

Prerequisites

Before getting started, make sure you have Docker installed (and, if your Docker doesn't include docker compose, the separate docker-compose tool).

Configuration

Copy .env.sample to .env and edit as appropriate (e.g. to change the port for Payload).

Development

Launch local containers using yarn dev or, if you don't have yarn installed, plain docker-compose up / docker compose up.

The docker-compose.yml file includes everything you need to run the containers. The containers use the environment variables declared in the .env file, and mounted volumes to store data persistently even after the containers are stopped and started.

Deployment

Whenever the repository is updated, Drone builds new Docker images for Payload and Astro, and deploys a new Docker Swarm stack to the HOST configured in .drone.yml.

Whenever changes are made to Payload content on the live site, Drone uses the Astro builder image to regenerate the static site, and publish it to the Nginx container by copying it into the Docker volume.