A symbolic link is a pointer that refers to another file or directory without copying or moving it. This can help you simplify your file structure, share files between web applications, and avoid duplication.
RunCloud supports two types of symlinks: namely Config and Directory. Let’s see what each one does!
Config (file) Symlink
Config Symlink allows you to add your configuration files, such as .env, .htaccess, etc. dynamically to your web applications. Configuration files are usually not tracked by git, as they may either contain sensitive information, or vary depending on the environment. This allows you to store your configuration files in a secure and encrypted format, and then link them to your web applications using symlink.
When you create a config file, you need to choose which Web Application will receive this config. Most of the time, you need to choose all Web Applications, unless each Web Application uses different configs.
For example, with Laravel and Symfony you have .env config files. Let’s say you name it application-env. Inside the ‘link from‘ field, you should add application-env and .env in the ‘link to‘ field.
The name of the file inside the configs folder doesn’t matter, but in the link to field, you should name it with the correct name for your application. If you need more help, read our step-by-step instructions to learn how to configure Symlink on RunCloud.
Note: The config file that you create will be encrypted and stored in the configs folder on your server. You will need to provide the secret key when you want to install or update the config file. If you forget the secret key, you will have to delete the config file and create a new one. Deleting the config file will not affect your web application folder.
Directory Symlink
Directory Symlink allows you to link your uploaded files or folders, such as images, videos, documents, etc. Uploaded files or folders are usually not tracked by git, as they may change frequently or take up too much space. You can store your uploaded files or folders in a separate folder called ‘storage‘, and then link them to your web applications using Symlink.
Note: The folder that you link should be empty in your web application folder, otherwise it will be replaced by the Symlink.