How do I manage a git for two domains?

Asked

Viewed 79 times

2

I have a website that I’m working on, where we’re now starting to install version control and we’re having a hard time testing the site before sending it to production.

We have the following domains:

dominioprincipal.com.br
dev.dominioprincipal.com.br

There is the possibility to create some development branch in dev.dominioprincipal.com.br and stay the domain.com.br in master?

OTHER OPTION: We know that our hosting is managed by Cpanel, where you must create a .cpanel.yml to move from a folder previously created for git repositions to the main domain folder. However, this file must be versioned, and this generates rework. Any recommendation?

UPDATING

Estrutura de páginas

We currently work with this structure, where we commit to the folders within the repository, where each one must have their .cpanel.yml to redirect to the respective public_html, however, as .cpanel.yml must be versioned to work (as far as we currently know) whenever we do a new "upload" to a different website, it overwrites this file (which is basically our main problem)

  • 1 - Yes, there is. I have 2 and I push to dev and only when it’s ready do I push everything to the master. 2 - Change this to Amazon which you can then deploy directly to dev and production. 2 basic servers, 1 for each. ;)

  • @Jorgeb. Could you give me more information about how you do this process? Because it seems to me that’s exactly what I need!

  • It wouldn’t be the case to add one remote? That’s why you push the branches only in your respective repository...

  • 1

    You can use post-push triggers to start the build process for each of the versions. For example, every time you push the dev branch you release build in dev and the same with Prod. Github allows you to set up webhooks that do this service. It is also worth studying IC services such as Jenkins

  • @Felipeavelar added information that might clarify a little more, helped?

  • @Andersoncarloswoss added information that might clarify a little more, helped?

  • If the problem is to overwrite a file that shouldn’t be overwritten, what needs to be done is to remove the versioning file with git rm and then add it to . gitignore...

  • @Felipeavelar the question is not to remove the file, the question is: can I somehow visualize what is being developed without displaying to the end user? This file is giving us trouble... example: master branch and dev branch, can I just view dev? Even a thousand excuses for not being able to explain exactly my doubt... kkkkk

Show 3 more comments

1 answer

2


Although Git is used as the main medium of publishing, it is not the only tool to be used and in this case you should make use of a pipeline tool, which will help in a compilation process (in your case it seems to be static pages, yes), changing environment variables, etc...

Some tools that can help you, available in the cloud and free or initially free:

Initially it may seem that you are adding complexity to the development, but having an automated pipeline will bring you benefits, for example, not leaving various environment in code; safety, for example, make separation of dev environment and production, and secure promotion through promotion.

  • 1

    This was not exactly my problem, but when researching and knowing the technologies mentioned I was able to solve my problem... Heartfelt thanks my friend!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.