By default, Leonardo runs your Rails app (llamapress-simple
) as a Docker image baked into the system. To add new Gems or deeper Rails customization, you’ll need to:
- Clone & modify the Rails app
- Build & push a new Docker image
- Update Leonardo’s Docker Compose config to use your new image
- Restart services inside your Leonardo instance
All changes will persist across EC2 stops/starts because the instance root volume lives on EBS.
1. Clone the Rails app locally
git clone https://github.com/KodyKendall/LlamaPress-Simple
cd LlamaPress-Simple
2. Add new gems
Add your gem with bundle add
or edit the Gemfile
directly:
bundle add devise
bundle install
This updates Gemfile
and Gemfile.lock
. Commit these changes if you want to keep them versioned.
3. Build a new Docker image
Use Docker Buildx to build for linux/amd64
(the platform EC2 runs):
docker buildx build \
--platform linux/amd64 \
-t your-dockerhub-username/llamapress-simple:0.1.18 .
Push the image to Docker Hub:
docker push your-dockerhub-username/llamapress-simple:0.1.18
4. SSH into your Leonardo instance
From your local machine:
ssh ubuntu@your-instance-ip
Navigate to the Docker Compose directory:
cd ~/llamapress
5. Update docker-compose.yml
Open the file:
nano docker-compose.yml
Find the service for llamapress
and update the image tag:
llamapress:
image: your-dockerhub-username/llamapress-simple:0.1.18
build: .
ports:
- "3000:3000"
# other options…
Save and exit.
6. Pull & restart the container
docker compose pull llamapress
docker compose up -d llamapress
This pulls your new image and restarts the container in detached mode.
7. Verify
Check logs:
docker compose logs llamapress
Visit your Leonardo instance in the browser → your Rails app is now running with the new gems.
⚡ Notes
- Changes to
docker-compose.yml
persist across stops/starts. (Your instance’s filesystem is preserved). - To make new users get the updated config by default, bake a new AMI with the updated compose file.
- Use semantic versioning for your images (e.g.,
0.1.18
,0.1.19
) to avoid confusion.
Leave a Reply