#
Configuring a Service in StationOps
This guide provides step-by-step instructions for configuring a service in your project.
#
Steps to Configure a Service
Create a New Configuration
Navigate to your Project Dashboard, create a new configuration, and scroll down to the Service Configuration section.Fill Out the Service Configuration
Complete the following fields to set up your service:- Framework: Select a framework or choose Docker to use a custom
Dockerfile
from your application's root directory. - Environment Version: Specify the appropriate version for your framework.
- Connection: Define the connection settings (see here for more details).
- Account: Enter your Git account name.
- Repository: Provide the Git repository name.
- Branch: Select the branch to use for deployments.
- Framework: Select a framework or choose Docker to use a custom
Set Up Deployment Scripts Configure pre-deployment and build scripts for your service:
Pre-Deployment Script:
This script runs once before each deployment. It is useful for tasks such as database migrations.
Example:php artisan migrate --force
Application Build Script:
Define Bash commands executed in the root of the application directory to build the application before the Docker build.
#
Additional Configuration Options
Use File-Based Environment Configuration
This option creates environment-scoped
.env
files in the root directory.Useful for frontend services where the build process generates static files and direct environment configuration is not possible.
File naming format:
.env.[environment name]
Create an Image per Environment
Generates a unique image for each environment rather than using a single image for all.
Essential for frontend services where static files are built during deployment and cannot access environment variables directly.
The environment name is passed to Docker as an argument using the variable:
STATION_OPS_ENV
The image above shows the configuration settings for a frontend service.
- Scroll Down and Click Create
- Once all configurations are set, scroll down and click Create to save your settings.
#
Additional Resources
⭐ StationOps Wizard
For more information on how to configure services see the StationOps Wizard walkthrough