This guide deploys Solidus 4.6 with Docker Compose on Debian 10+, Ubuntu 20.04+, or RHEL 9+.
Current Version: 4.6.2 (released November 27, 2025)
⚠️ Important: No official Solidus Docker image exists. This playbook builds a custom Docker image.
- name: Deploy Solidus with Docker Compose
hosts: solidus
become: true
vars:
app_root: /opt/solidus
app_port: 3000
db_name: solidus
db_user: solidus
db_password: "solidus-db-password-change-me"
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create app directory
file:
path: "{{ app_root }}"
state: directory
mode: "0755"
- name: Write Dockerfile for Solidus
copy:
dest: "{{ app_root }}/Dockerfile"
mode: "0644"
content: |
FROM ruby:3.1-slim
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
libvips-dev \
nodejs \
npm \
git \
imagemagick \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g yarn
WORKDIR /app
RUN gem install bundler:2.4.0
EXPOSE 3000
- name: Write Docker Compose file for Solidus
copy:
dest: "{{ app_root }}/docker-compose.yml"
mode: "0644"
content: |
version: '3.8'
services:
postgres:
image: postgres:14
container_name: solidus-postgres
restart: unless-stopped
environment:
POSTGRES_DB: {{ db_name }}
POSTGRES_USER: {{ db_user }}
POSTGRES_PASSWORD: {{ db_password }}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- solidus-net
solidus:
build: .
container_name: solidus
restart: unless-stopped
depends_on:
- postgres
ports:
- "{{ app_port }}:3000"
environment:
DATABASE_URL: postgresql://{{ db_user }}:{{ db_password }}@postgres:5432/{{ db_name }}
RAILS_ENV: production
SECRET_KEY_BASE: change-me-to-random-secret-key
volumes:
- solidus_app:/app
networks:
- solidus-net
volumes:
postgres_data:
solidus_app:
networks:
solidus-net:
- name: Build and start application stack
command: docker compose up -d --build
args:
chdir: "{{ app_root }}"
- name: Wait for Solidus to be ready
wait_for:
port: "{{ app_port }}"
timeout: 300
delay: 10
- name: Display installation information
debug:
msg: |
Solidus installation is ready!
Access: http://{{ inventory_hostname }}:{{ app_port }}
IMPORTANT:
1. Create admin user: docker compose exec solidus rails runner "Spree::AdminUser.create!(email: 'admin@example.com', password: 'password123', password_confirmation: 'password123')"
2. Change the admin password immediately after first login
3. Configure SSL/TLS via reverse proxy for production
4. Run asset precompilation: docker compose exec solidus rails assets:precompile
http://YOUR-SERVER:3000docker compose exec solidus rails assets:precompile| Variable | Description | Default |
|---|---|---|
app_root |
Installation directory | /opt/solidus |
app_port |
External port for web access | 3000 |
db_name |
PostgreSQL database name | solidus |
db_user |
PostgreSQL database user | solidus |
db_password |
PostgreSQL database password | (change me) |