Codebase management
Manage your environment code in better waySiteBox seamlessly integrates with repositories stored on external Git servers, significantly enhancing the code deployment process. Each deployment process includes the codebase, which represents the source code of your web application. SiteBox provides the flexibility to create environments based on two types of codebase sources:
- GitHub branch – you can use a GitHub branch as the source for your deployment, allowing you to easily sync your application with changes made in your GitHub repository.
- ZIP file – alternatively, you can deploy your application using a ZIP archive as the source, providing a convenient way to package and deploy your codebase.
During the deployment process, SiteBox fetches the latest changes from the selected codebase source and creates a new instance of your application. This streamlined workflow ensures that your web application is always up-to-date and ready to serve your users with the latest features and improvements.
Git as source of truth for codebase
Before creating an environment, it is mandatory to set up a repository and grant SiteBox access to it. SiteBox will establish a connection with your project through this repository.
During the environment creation process, you will have the option to select an existing branch from your repository, or SiteBox can generate a new branch for you. This branch will be linked to your backend environment and become an integral part of your continuous delivery pipeline.
Each new environment within your project will be stored on a new branch within the same repository. This approach facilitates ultra-fast deployments of your environments, ensuring that your development and deployment processes are seamless and efficient.
When SiteBox interacts with your repository, it exclusively performs non-destructive operations, prioritizing the safety and integrity of your codebase and content.
For optimal deployment performance, refrain from storing content other than what's specified (e.g., uploads and the database) in your repository. Keeping the repository focused on codebase elements can significantly enhance deployment efficiency.
If you need to import a database or media, consider using the Snapshot import feature, designed to streamline the process while maintaining the stability of your environment.
See also:
Snapshots
Manage state of your website with snapshots
Codebase structure
In the Git representation of your environment, the directory structure should adhere to the following format:
repository/
├── root_dir_files
├── plugins
├── themes
└── ...
- root_dir_files – files from this directory will be installed in the root directory of your web application. For
example, you can place files like
robots.txt
in this directory, and they will be placed at the root of your web application. - plugins – this directory is equivalent to the
/wp-content/plugins
directory in WordPress. - themes – this directory corresponds to the
/wp-content/themes
directory in WordPress.
Keep in mind the uploads
directory should not be tracked on the Git repository.
SiteBox automatically filters out and ignores any directories and files that are not part of the predefined structure, ensuring that only essential components are included in the deployment process.
During the deployment process, all files from the codebase repository will be copied to their respective WordPress directories, ensuring that your WordPress environment is correctly configured and up-to-date.
Root directory files
Using the root_dir_files
directory, you can add any files that will be available from the root directory of your
website. By adding the file root_dir_files/favicon.ico
for example, the file will be available at the link
https://acme-website.com/favicon.ico
.
The root_dir_files
directory has several rules and limits:
- files and folders in the directory, for security reasons, cannot overwrite any existing file on the server, so for
example the file
root_dir_files/wp-config.php
will be ignored, - files and folders with names preceded by a dot like
.config
are ignored, the exception is the.well-known
directory, - files contained in the directory cannot overwrite any server configuration, so files like
.htaccess
will not work.