Code Monkey home page Code Monkey logo

Comments (9)

sameersbn avatar sameersbn commented on May 18, 2024

@arnos so you only need to specify the SMTP_HOST and SMTP_PORT for mails to go out?
This might be difficult considering the broader audience. You can however override the smtp mailer configuration.

This is how you do it.

Download https://github.com/sameersbn/docker-gitlab/raw/master/config.tar.bz2 and extract the file config/gitlabhq/smtp_settings.rb into /opt/gitlab/data/config/gitlabhq/

wget "https://github.com/sameersbn/docker-gitlab/raw/master/assets/setup/config.tar.bz2" -O /tmp/config.tar.bz2
cd /opt/gitlab/data/
tar -jvxf  /tmp/config.tar.bz2 config/gitlabhq/smtp_settings.rb

You can edit the /opt/gitlab/data/config/gitlabhq/smtp_settings.rb to remove the smtp settings you do not require and restart the gitlab application for the changes to take effect.

Using this method you can literally override all of my configuration but be warned that you could break the whole application, especially if you change paths in the configuration files. Generally parameters with {{}} around their values are the ones safe to edit. The values with the {{}} that you leave behind will be updated as per the configuration you provide via the environment configuration.

Using this method you can also change the default projects number as you have mentioned in #42 and could also have been used to get by #36. I have not documented it yet so that I can see how people are using the image and understand what all options I should be adding.

from docker-gitlab.

arnos avatar arnos commented on May 18, 2024

Yes, and all I'm proposing is that the default be changed to include the
other (SMTP_AUTHENTICATION, etc...) only when a user fills it out. This way
you still reach a broader audience.

There could also be another flag say (GMAIL_DEFAULT=true) that would fill
the SMTP parameters with the gmail config.

In terms of manually updating the configurations that's what I've been
doing for testing and it's maintainable at a certain level, but it means
keeping my own container image and then syncing it up with yours at every
upgrade.

How about an alternate approach based on the idea I mentioned in the logs
issue (#40), instead of having to input all the options to configure gitlab
everytime and running it through the init script have init check if
pre-configured configuration files exist in /opt/gitlab/ (a mounted volume
on the host) and use these to overwrite the default config files.

In this manner configurations can be saved and re-used.

On Thu, Apr 10, 2014 at 1:30 PM, Sameer Naik [email protected]:

@arnos https://github.com/arnos so you only need to specify the
SMTP_HOST and SMTP_PORT for mails to go out?
This might be difficult considering the broader audience. You can however
override the smtp mailer configuration.

This is how you do it.

Download
https://github.com/sameersbn/docker-gitlab/raw/master/assets/setup/config.tar.bz2and extract the file config/gitlabhq/smtp_settings.rb into
/opt/gitlab/data/config/gitlabhq/

wget "https://github.com/sameersbn/docker-gitlab/raw/master/assets/setup/config.tar.bz2" -O /tmp/config.tar.bz2
cd /opt/gitlab/data/
tar -jvxf /tmp/config.tar.bz2 config/gitlabhq/smtp_settings.rb

You can edit the /opt/gitlab/data/config/gitlabhq/smtp_settings.rb to
remove the smtp settings you do not require and restart the gitlab
application for the changes to take effect.

Using this method you can literally override all of my configuration but
be warned that you could break the whole application, especially if you
change paths in the configuration files. Generally parameters with _{{}}_around their values are the ones safe to edit. The values with the
{{}} that you leave behind will be updated as per the configuration you
provide via the environment configuration.

Using this method you can also change the default projects number as you
have mentioned in #42https://github.com/sameersbn/docker-gitlab/issues/42and could also have been used to get by
#36 #36. I have not
documented it yet so that I can see how people are using the image and
understand what all options I should be adding.

Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-40113799
.

from docker-gitlab.

sameersbn avatar sameersbn commented on May 18, 2024

@arnos I think you misunderstood. The edit that I mentioned is done at the data store on the host, not inside the container.

How this works is that when the container is started, it checks if there are any configuration overrides in the config/ directory of the datastore, which in this case would be the smtp_settings.rb file in the /opt/gitlab/data/config/gitlabhq folder. Now this file would be used as the template on top of which the container would start applying the configuration.

This means that you can upgrade the image normally without having to worry much. The only time you could face an issue is if the base template itself changed, In which case you would have to update your copy in /opt/gitlab/data/config/gitlabhq. So the golden rule of thumb would be to copy only the files you wish to change in the /opt/gitlab/data/config directory and apply the rest of the config using the environment variables.

How about an alternate approach based on the idea I mentioned in the logs issue (#40), instead of having to input all the options to configure gitlab everytime and running it through the init >script have init check if pre-configured configuration files exist in /opt/gitlab/ (a mounted volume >on the host) and use these to overwrite the default config files.

Well this is exactly what the files inside /opt/gitlab/data/config/ are meant to do. You can specify the entire configuration here and the image will just pick up this configuration and fill out whatever is left to be filled.

Generating the configuration at run time is important so that we do not end up in a fix when the configs are changed upstream (read my above "golden rule of thumb" comment).

NOTE: the mountpoint /opt/gitlab/data I mentioned is in reference to the path of the datastore I have used in the README examples. This could be a different path in your case if you have changed it.

from docker-gitlab.

arnos avatar arnos commented on May 18, 2024

My bad, you're right I missed that.

Ok after testing both the project number and the SMTP config changes in
/opt/gitlab/data/config.

On Thu, Apr 10, 2014 at 2:23 PM, Sameer Naik [email protected]:

@arnos https://github.com/arnos I think you misunderstood. The edit
that I mentioned is done at the data storehttps://github.com/sameersbn/docker-gitlab#data-storeon host, not inside the container.

How this works is that when the container is started, it checks if there
are any configuration overrides in the config/ directory of the datastore,
which in this case would be the smtp_settings.rb file in the
/opt/gitlab/data/config/gitlabhq folder. Now this file would be used as the
template on top of which the container would start applying the
configuration.

This means that you can upgrade the image normally without having to worry
much. The only time you could face an issue is if the base template itself
changed, In which case you would have to update your copy in
/opt/gitlab/data/config/gitlabhq. So the golden rule of thumb would be to
copy only the files you wish to change in the /opt/gitlab/data/config
directory and apply the rest of the config using the environment variables.

How about an alternate approach based on the idea I mentioned in the logs
issue (#40 #40),
instead >of having to input all the options to configure gitlab everytime
and running it through the init >script have init check if pre-configured
configuration files exist in /opt/gitlab/ (a mounted volume >on the host)
and use these to overwrite the default config files.

Well this is exactly what the files inside /opt/gitlab/data/config/ are
meant to do. You can specify the entire configuration here and the image
will just pick up this configuration and fill out whatever is left to be
filled.

Generating the configuration at run time is important so that we do not
end up in a fix when the configs are changed upstream (read my above
"golden rule of thumb" comment).

NOTE: the mountpoint /opt/gitlab/data I mentioned is in reference to
the path of the datastore I have using in the READMEhttps://github.com/sameersbn/docker-gitlab#data-storeexamples. This could be a different path in your case if you have changed
it.

Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-40120336
.

from docker-gitlab.

sameersbn avatar sameersbn commented on May 18, 2024

@arnos so should we close this?

from docker-gitlab.

arnos avatar arnos commented on May 18, 2024

Yes

On Friday, April 11, 2014, Sameer Naik [email protected] wrote:

@arnos https://github.com/arnos so should we close this?

Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-40175296
.

from docker-gitlab.

jay61439476 avatar jay61439476 commented on May 18, 2024

Hi, @sameersbn
I use this in my LAN,
I clone smtp_settings.rb to /opt/gitlab/data/config/gitlabhq

change to

# To enable smtp email delivery for your GitLab instance do next:
# 1. Rename this file to smtp_settings.rb
# 2. Edit settings inside this file
# 3. Restart GitLab instance
#
if Rails.env.production?
  Gitlab::Application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.smtp_settings = {
    address: "exmail.my.com.cn",
    port: 25,
    domain: "my.com.cn",
    authentication: "plain"   #I also test  authentication: ":plain", but still not work...
  }
end

But I can't receive mail, the production.log show : Sent mail to [email protected] (5135.6ms)
I run this docker use:

 docker run --name=gitlab -p 88:80 -d \
  --link mysql:mysql \
  -e "DB_USER=gitlab" -e "DB_PASS=root" -e "DB_NAME=gitlabhq_production" \
  -e "[email protected]" -e "[email protected]" \
  -e "GITLAB_SIGNUP=true" \
  -e "GITLAB_HOST=gitlab2.my.com.cn" \
  -v /opt/gitlab/data:/home/git/data \
  sameersbn/gitlab:7.0.0

I have an old gitlab, configure step by step. has SMTP conf in production.rb like this

  ## SMTP Settings
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address => 'exmail.my.com.cn',
      :port => 25,
      :domain => 'my.com.cn', ## My Domain
      :authentication => :plain, ## Let it be plain as it is inside my LAN
      ##:user_name => '[email protected]', ## This is not required as long as
      ##:password => 'yourPassword', ## SMTP Gateway allows anonymous relay
      ##:enable_starttls_auto => true ## In LAN
      ##:user_name => '',
      ##:password => '',
      :enable_starttls_auto => true,
      :openssl_verify_mode => 'none'
  }
  config.eager_load = true
  config.assets.js_compressor = :uglifier

  config.allow_concurrency = false
end

This server works OK, is there any thing wrong I set in smtp_settings.rb

from docker-gitlab.

sameersbn avatar sameersbn commented on May 18, 2024

@jay61439476 All you need to do is correctly configure the smtp_settings.rb. I see that you have not added the :enable_starttls_auto and :openssl_verify_mode like you have in your old gitlab installation. I reckon that copying old config and updating the syntax should just work.

I guess your smtp_setting.rb should look like this:

if Rails.env.production?
  Gitlab::Application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.smtp_settings = {
    address: 'exmail.my.com.cn',
    port: 25,
    domain: "my.com.cn",
    authentication: "plain",
    enable_starttls_auto: true,
    openssl_verify_mode: "none"
  }
end

If this does not work then Iā€™m afraid I will not be of much help.

from docker-gitlab.

jay61439476 avatar jay61439476 commented on May 18, 2024

thanks @sameersbn
It still no work, I'm trying to find other configure, I run docker-gitlab and my old gitlab on the same server, I will send it to a new server and try again.

thank you~

from docker-gitlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.