Files
Files in Thevenin allow you to upload and manage configuration files, scripts, and other static content that your applications need to run. These files can be mounted into your containers at specific paths, making them accessible to your applications at runtime.
Overview
The Files feature enables you to:
- Upload configuration files, scripts, or any static content
- Mount files into containers at specific paths
- Manage files across different environments
Creating a File
To create a new file:
-
Navigate to your environment
-
Go to the Attachments section
-
Click on Files
-
Click Create File
-
Fill in the required information:
- Name: A descriptive name for the file
- Description: Optional description of the file's purpose
- File Path: The path where the file will be mounted in the container (e.g.,
/app/config/settings.json) - Content: The actual content of the file
-
Click Create to save the file
Mounting Files in Applications
Once you've created a file, you can mount it in your applications:
- Go to your application's configuration
- In the Files section, select the files you want to mount
- The files will be available at their specified paths when the container starts
File Path Guidelines
When specifying file paths:
- Use absolute paths (e.g.,
/app/config/app.conf) - Ensure the path doesn't conflict with existing container files
- Consider using standard configuration directories like
/etc/,/config/, or/app/config/
Use Cases
Configuration Files
Mount application configuration files like config.json, settings.yml, or .env files.
{
"database": {
"host": "db.example.com",
"port": 5432
}
}
Scripts
Upload initialization scripts or utility scripts that your application needs.
#!/bin/bash
echo "Running initialization script..."
# Your script content
SSL Certificates
Store and mount SSL certificates for secure connections.
Application Secrets
Mount sensitive configuration files (though consider using Variable Sets for simple key-value secrets).
Best Practices
- Use Descriptive Names: Name your files clearly to indicate their purpose
- Environment-Specific Files: Create separate files for different environments
- File Size: Keep files reasonably sized for quick loading and deployment
- Security: Be cautious with sensitive data - ensure files containing secrets are properly secured
Managing Files
Updating a File
To update an existing file:
- Navigate to the file in your environment's Attachments section
- Click on the file to open it
- Click Edit
- Update the content or configuration
- Click Save
Deleting a File
To delete a file:
- Navigate to the file in your environment's Attachments section
- Click on the file
- Click Delete
- Confirm the deletion
Deleting a file that's currently mounted in a running application may cause errors. Ensure you remove file mounts from applications before deleting files.
Common Patterns
Application Configuration
# app-config.yml
server:
port: 8080
host: 0.0.0.0
database:
connection_string: ${DB_CONNECTION_STRING}
Nginx Configuration
# nginx.conf
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://backend:8080;
proxy_set_header Host $host;
}
}
Initialization Scripts
#!/bin/bash
# init.sh
echo "Starting application initialization..."
npm run migrate
npm run seed
echo "Initialization complete!"
Limitations
- Maximum file size: 10MB per file
- Files are read-only inside containers
- File paths must be absolute
- Special characters in file paths should be avoided
Next Steps
- Learn about Volumes for persistent data storage
- Explore Variable Sets for environment variables
- Read about Creating Applications to use your files