I have the following situation. Web content of my app is located in a standard directory /var/www/my.domain.com/html/
. Also I have a folder users_statics
somewhere inside this directory, where my app stores some essential files that were uploaded by users. Note, that these files are not incorporated in frontend build, and during usage only URLs to this files are needed.
However, my deploy pipeline script deletes all files inside the /var/www/my.domain.com/html/
and inserts new frontend build, which by default doesn't contain user_statics
directory. For example:
rm -rf /var/www/my.domain.com/html/*
cp -av build/. /var/www/my.domain.com/html/
So I am obliged to store user_statics
directory in some other location and after every deployment rsync
it to the web content folder:
mkdir /var/www/my.domain.com/html/.../user_statics
rsync -qah ./user-statics-bkp/* /var/www/my.domain.com/html/.../user_statics
I am not sure this is the most desirable way to deal with this folder, since by this time I want to add API to the backend app to interact with its contents. Thus, for example I can run into the incorrect API calls to this folder during deployment process.
I see the following options but none of them seems to me perfect:
- Somehow rewrite CD pipeline to "ignore" this folder during the deployment.
- Move this folder to the
/var/www/html/
folder and write additional directives to nginx config file.
- Open subdomain for this folder and create server block for this subdomain. However, I am not sure if this one folder "deserves" to be separated to the new server block.
From your experience are there any better ways to correctly deal with it?