Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document environmental variables for pre-build container #5

Open
frlan opened this issue Nov 27, 2024 · 10 comments
Open

Document environmental variables for pre-build container #5

frlan opened this issue Nov 27, 2024 · 10 comments

Comments

@frlan
Copy link

frlan commented Nov 27, 2024

I think most likely those will be the ones from composer file

      CIVICRM_DB_HOST: db
      CIVICRM_DB_PORT: 3306
      CIVICRM_DB_NAME: civicrm
      CIVICRM_DB_USER: civicrm
      CIVICRM_DB_PASSWORD: ${MYSQL_PASSWORD}
      # CIVICRM_DSN: mysql://civicrm:${MYSQL_PASSWORD}@db:3306/civicrm # Note: you can also pass database credentials as a DSN.
      CIVICRM_UF_BASEURL: http://localhost:8760
      CIVICRM_SETTING_EXTENSIONS_DIR: /var/www/html/civicrm-extensions

but it would be nice to have a complete list with some explanation

@michaelmcandrew
Copy link
Collaborator

Hey there,

Hopefully the database ones are self explanatory.

CIVICRM_UF_BASEURL is the URL your are serving the site from.

I don't think there is a simple command to get a complete list of settings that you can set by environment variables but on an installed site, you can run the following command:

cv ev 'echo implode("\n", array_column(array_filter(Civi\Core\SettingsMetadata::getMetadata(), fn($s)=>!empty($s["is_env_loadable"])),"global_name"))'

@michaelmcandrew
Copy link
Collaborator

@ufundo do you have any thoughts on how we might make environment variables more discoverable?

@ufundo
Copy link

ufundo commented Dec 11, 2024

I have had a plan for this since Ashbourne, but other things have intervened.

The idea is: make an Api4 entity for SettingsMeta, to allow browsing using SearchKit.

Let me try get to POC.

@michaelmcandrew
Copy link
Collaborator

@ufundo - makes sense, and fields like 'description' would be useful for people.

@michaelmcandrew
Copy link
Collaborator

A nice to have would be to have some of them documented somewhere that you don't need an installed civicrm to consult.

@ufundo
Copy link

ufundo commented Dec 11, 2024

For that I was thinking to point to smaster from the docs (that way should always be an up to date reference)

@ufundo
Copy link

ufundo commented Dec 11, 2024

@michaelmcandrew could you have a look at civicrm/civicrm-core#31592 ?

@frlan
Copy link
Author

frlan commented Dec 12, 2024

I would really appreciate if there is just a list of variables I have to set when bootstrapping some docker based civicrm until the point an admin can do a first login.

@michaelmcandrew
Copy link
Collaborator

The list of variables required for installation is:

  • CIVICRM_DB_HOST
  • CIVICRM_DB_PORT
  • CIVICRM_DB_NAME
  • CIVICRM_DB_USER
  • CIVICRM_DB_PASSWORD
  • CIVICRM_UF_BASEURL

You also need to set the admin username and password as part of the installation script. See https://github.com/civicrm/civicrm-docker/blob/main/build/civicrm/civicrm-docker-install for an example of how you so that and https://github.com/civicrm/civicrm-docker?tab=readme-ov-file#installation for some more background.

@frlan
Copy link
Author

frlan commented Dec 13, 2024

After playing around and searching i finally found the script. I needed to adjust a little for my need, but this would be extremely helpful to have it visible linked in main README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants