I am trying to work with Gitlab CI for deploying websites, and all was going really well until I started hitting some problems.
The code I am using is here:
variables: HOSTNAME: '<hostname>' USERNAME: '<username>' PASSWORD: '<password>' PATH_DEV: '/path/to/www' # Define the stages (we can add as many as we want) stages: # - build - deploy # The code for development deployment deploy_dev: stage: deploy script: - echo "Deploying to development environment..." - rm .gitlab-ci.yml - rsync -urltvz --filter=':- .gitignore' --exclude=".git" -e "sshpass -p"$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" * $USERNAME@$HOSTNAME:$PATH_DEV - echo "Finished deploying." environment: name: Development url: http://dev.domain.com only: - envdev
I have cut down the above and removed the build step etc, this is for some extra things we do with the content.
It serves it’s purpose well, but recently we have started noticing some problems, so as more of a collaboration and some help from someone, I want to try and learn a better way for deploying website code, this could be of any kind of framework, Magento, Joomla, Vue.JS, React etc, it just needs to deploy the contents, but update accordingly.
So the issue I have is currently using rsync, I am telling it to read the .gitignore file as to what it should ignore when deploying, but if for example I add a new file, then delete it in another commit, it will not delete the file, now in rsync I can add the “–remove” flag, but doing this causes issues with user uploaded content, so sometimes if we add a few images that are on the site from the git repo to a folder this is fine and uploads correctly, but because user uploaded content is not in the git repo, user uploads on the site are removed - as it uses rsync,
which syncs both repos, which is great, but as I just mentioned causes problems with uploaded user content.
So I was wondering if anyone else has any other ways of deploying websites where it will read the git repo and deploy specific files etc, or other? Anything is fine, but currently our company use BeanStalk, which is great, but our client codebase’s are getting to large either hitting repo or space limits constantly, and because we are on the top tier anything else just get’s stupid expensive, so please do not offer other SaaS providers, we are looking for ways to do it with Gitlab CI only.
Anyway, thanks in advance.