To deploy the documentation website, we use Lttle, a serverless platform for deploying applications and services.
The deployment configuration is defined in the lttle directory, which contains the necessary configuration files for deploying the website and the TypeSense server.
- The lttle.cloud CLI installed and configured.
- Docker installed on your local machine.
- Authentication to the container registry where the Docker images are stored.
- Authentication to the
lttleCLI with the appropriate credentials.
For local development, you can create a .env file in the root of the project to define the necessary environment variables. Here's an example of the variables you might need:
TYPESENSE_API_KEY=some-api-keyFor production deployment there are multiple variables needed because we use them to deploy the services on both the production and for preview deployments.
DOCS_URL=https://path.to.docs.url
TYPESENSE_FQDN=https://path.to.typesense.url
TYPESENSE_API_KEY=some-api-key-
Build the Docker Images: Ensure that the Docker images for the documentation website and the TypeSense scraper are built and pushed to a container registry. You can use the following commands:
docker build -f docker/dockerfile . -t aifrim/lttle-docs:latest docker push aifrim/lttle-docs:latest docker build -f docker/typesense-scraper.dockerfile docker -t aifrim/typesense-scraper:latest docker push aifrim/typesense-scraper:latest -
Deploy the Services: Use the
lttleCLI to deploy the services defined in thelttledirectory. Navigate to thelttledirectory and run:lttle deploy ./lttle
-
Restart the Services: If you need to restart the services, you can use the following command:
lttle restart --namespace docs --name nginx-docs lttle restart --namespace docs --name typesense-search lttle restart --namespace docs --name typesense-scraper
All of these steps have been automated in the deploy.sh script, which you can run to perform the deployment:
./deploy.shIf you only need to update the documentation website without redeploying the entire stack, you can use the following command:
First you need to build and push the updated Docker image for the documentation website:
docker build -f docker/dockerfile . -t aifrim/lttle-docs:latest
docker push aifrim/lttle-docs:latestThen, deploy and restart only the documentation website service:
lttle deploy ./lttle/nginx-docs.yamlOr you can use the deploy-docs.sh script:
./deploy-docs.sh