Self-Hosting
This guide covers setting up and running Wraft on your own infrastructure for complete control over your document management system.
Prerequisites
Before building Wraft, ensure you have all the following dependencies installed:
Core Dependencies
- Elixir 1.18.4
- Erlang/OTP 27.0.1
- PostgreSQL (latest stable version)
- MinIO - S3 compatible object storage
- Pandoc 3.6.3 - Document conversion engine
- ImageMagick - Image processing
- LaTeX - PDF generation and typography
- Typst 0.13.0 - Modern typesetting system
- Java 17 - For PDF signing functionality
- Rust toolchain - For native dependencies
The exact versions are defined in the .tool-versions
file in the repository.
Development Setup
1. Clone the Repository
2. Elixir & Erlang Setup
Since these are defined in .tool-versions
, asdf
will install the correct versions:
First, install asdf version manager.
Add the required plugins:
Install the versions:
⚠️ For Ubuntu users: You also need to install the inotify-tools
package.
macOS:
Linux:
3. PostgreSQL Setup
Select your OS from the PostgreSQL downloads page and follow the installation instructions.
Verify installation:
Test connectivity:
4. MinIO Setup
Download the latest version of MinIO from here and follow the OS-specific installation instructions.
Start a local MinIO instance:
Access the MinIO Console at http://127.0.0.1:9000
5. Pandoc Installation
macOS:
Linux:
- Download the appropriate package from Pandoc releases
- Install the deb package:
where $DEB
is the path to the downloaded deb file.
6. ImageMagick Installation
Download ImageMagick from here for your OS.
Linux:
7. LaTeX Installation
macOS: Install MacTeX distribution from here. Choose the version that supports your device.
Linux: Install Tex Live distribution:
For a LaTeX editor:
8. Typst Installation
Install Typst 0.13.0 for modern typesetting capabilities:
macOS:
Linux: Download from Typst releases and install manually.
9. Java 17 Installation
macOS:
Linux:
10. Rust Toolchain
Install Rust for native dependencies:
11. Typesense Setup
Typesense is a fast, typo-tolerant search engine used by Wraft for search functionality.
For detailed installation instructions, refer to the official Typesense documentation.
Download from Typesense releases or run manually:
Note: Replace your-api-key-here
with a secure API key. Default port is 8108.
Application Setup
Environment Configuration
-
Load environment variables
-
Setup the project
Running Wraft
Start Phoenix endpoint with interactive shell:
Start without interactive shell:
Visit localhost:4000
from your browser.
API documentation is available at http://localhost:4000/api/swagger/index.html#/.
Frontend Setup
Clone the frontend repository separately:
Refer to the README.md in the frontend repository for setup instructions.
Default User
The default username and password:
Customization
Environment Configuration
Wraft uses environment variables for configuration. Key configuration options include:
- Database connection settings
- MinIO/S3 storage configuration
- Application secrets and keys
- External service integrations
- Typesense search configuration
Database Migrations
To run database migrations:
To rollback migrations:
Asset Compilation
For production builds, compile assets:
Development Workflow
Interactive Development
Start the development server with an interactive shell:
Hot Reloading
Wraft supports hot reloading during development. Changes to Elixir files will automatically reload the server.
Debugging
Use the interactive shell for debugging:
Production Build
For production deployment:
-
Set production environment
-
Install production dependencies
-
Compile for production
-
Run database migrations
-
Start the production server
Troubleshooting
Common Issues
- Database connection errors: Ensure PostgreSQL is running and accessible
- MinIO connection issues: Verify MinIO server is running on the correct port
- Missing dependencies: Run
mix deps.get
to install all dependencies - Permission errors: Ensure proper file permissions for the application directory
- Typesense connection: Verify Typesense server is running and API key is correct
- Java/PDF signing issues: Ensure Java 17 is properly installed and accessible
- Rust compilation errors: Update Rust toolchain and rebuild native dependencies
Getting Help
- Check the GitHub Issues for known problems
- Review the API Documentation for endpoint details
- Join the community discussions for support
- Check the frontend repository for UI-related issues