Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3432864
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:30:10+00:00 2026-05-18T07:30:10+00:00

I’m looking to hear some best practices… Assuming a web application that interacts with

  • 0

I’m looking to hear some best practices…

Assuming a web application that interacts with a few different production servers (databases, etc.)… should the configuration files that include database passwords be stored in source control (e.g., git, svn)?

If not, what’s the best way to keep track of server database (or other related) passwords that your application needs access to?

Edit: added a bounty to encourage more discussion and to hear what more people consider best practice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:30:10+00:00Added an answer on May 18, 2026 at 7:30 am

    There’s no single “silver bullet” answer here and it would all greatly depend on details.

    First of all, I consider best practice to separate all source code from configuration in separate repository. So, source code remains source code, but it’s installation or deployment (with configuration, passwords, etc) is the whole other thing. This way you’ll firmly separate developers’ tasks from sysadmins’ tasks and can ultimately build 2 distinct teams doing what’s they’re good at.

    When you have separate source code repository + deployment repository, your best next bet is considering deployment options. Best way I see here is using deployment procedures typical for a chosen OS (i.e. building autonomous packages for a chosen OS the way that OS’s maintainers do).

    For example, Red Hat or Debian packaging procedures usually mean grabbing a tarball of software from external site (that would be exporting sources from your source code VCS), unpacking it, compiling and preparing packages ready for deployment. Deployment itself should ideally mean just doing a quick & simple command that would install the packages, such as rpm -U package.rpm, dpkg --install package.deb or apt-get dist-upgrade (given that your built packages go to a repository where apt-get would be able to find them).

    Obviously, to get it working this way, you’ll have to supply all configuration files for all components of a system in a fully working state, including all addresses and credentials.

    To get more concise, let’s consider a typical “small service” situation: one PHP application deployed across n application servers running apache / mod_php, accessing m MySQL servers. All these servers (or virtual containers, that doesn’t really matter) reside in a protected private network. To make this example easier, let’s assume that all real internet connectivity is fronted by a cluster of k http accelerators / reverse proxies (such as nginx / lighttpd / apache) which have very easy configuration (just internal IPs to forward to).

    What do we have for them to be connected and fully working?

    • MySQL servers: set up IPs/hostnames, set up databases, provide logins & passwords
    • PHP application: set up IPs/hostnames, create configuration file that will mention MySQL servers IPs, logins, passwords & databases

    Note that there are 2 different “types” of information here: IPs/hostnames is something fixed, you’d likely want to assign them once and for all. Logins & passwords (and even database names), on the other hand, are purely for connectivity purposes here – to make sure for MySQL that it’s really our PHP application connecting to it. So, my recommendations here would be splitting these 2 “types”:

    • “Permanent” information, such as IPs, should be stored in some VCS (different from source code VCS)
    • “Transient” information, such as passwords between 2 applications, should be never stored, but generated during generation of deployment packages.

    The last and the toughest question remains here: how to create deployment packages? There are multiple techniques available, 2 main ways are:

    • Exported source code from VCS1 + “permanent” configuration from VCS2 + building script from VCS3 = packages
    • Source code is in VCS1; VCS2 is a distributed version control (like git or hg) which essentially contains “forks” of VCS1 + configuration information + building scripts which can generate . I personally like this approach better, it’s much shorter and ultimately easier to use, but learning curve may be a bit steeper, especially for admin guys who’ll have to master git or hg for it.

    For an example above, I’d create packages like:

    • my-application-php – which would depend on mod_php, apache and would include generated file like /etc/my-php-application/config.inc.php that will include MySQL database IPs/hostnames and login / password generated as md5(current source code revision + salt). This package would be installed on every of n application servers. Ideally, it should be able install on a cleanly installed OS and make a fully working application cluster node without any manual activity.
    • my-application-mysql – which would depend on MySQL-server and would include post-install script that:
      • starts MySQL server and makes sure it will start automatically on OS start
      • connects to MySQL server
      • checks if required database exists
      • if no – creates the database, bootstraps it with contents and creates login with password (the same logins & passwords as generated in /etc/my-php-application/config.inc.php, using md5 algorithm)
      • if yes – connects to the database, applies migrations to bring it up to the new version, kills all older logins / passwords and recreates the new login/password pair (again, generated using md5(revision + salt) method)

    Ultimately, it should bring the benefit of upgrading your deployment using single command like generate-packages && ssh-all apt-get dist-upgrade. Also, you do not store inter-applications passwords anywhere and they get regenerated on every update.

    This fairly simple example illustrates a lot of methods you can employ here – but, ultimately, it’s up to you to decide which solution is better here and which one is overkill. If you’ll put more details here or as a separate question, I’ll gladly try to get into details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm looking for suggestions for debugging... If you view this site in Firefox or
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I have some data like this: 1 2 3 4 5 9 2 6
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.