From 76994f7d295c8c5d1e2703868f25bc748284f68a Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 15 Jun 2015 11:14:26 -0400 Subject: Modifying sendmail to allow for non-encrypted connection for ease setup of local mail sender --- config/config.json | 1 + utils/config.go | 1 + utils/mail.go | 27 +++++++++++++++++++-------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/config/config.json b/config/config.json index 4eab907f7..955947a83 100644 --- a/config/config.json +++ b/config/config.json @@ -57,6 +57,7 @@ "SMTPUsername": "", "SMTPPassword": "", "SMTPServer": "", + "UseTLS": true, "FeedbackEmail": "feedback@xxxxxxmustbefilledin.com", "FeedbackName": "", "ApplePushServer": "", diff --git a/utils/config.go b/utils/config.go index b6688de68..37da59315 100644 --- a/utils/config.go +++ b/utils/config.go @@ -79,6 +79,7 @@ type EmailSettings struct { SMTPUsername string SMTPPassword string SMTPServer string + UseTLS bool FeedbackEmail string FeedbackName string ApplePushServer string diff --git a/utils/mail.go b/utils/mail.go index b8c2f4f9b..645dcae24 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -40,16 +40,23 @@ func SendMail(to, subject, body string) *model.AppError { auth := smtp.PlainAuth("", Cfg.EmailSettings.SMTPUsername, Cfg.EmailSettings.SMTPPassword, host) - tlsconfig := &tls.Config{ - InsecureSkipVerify: true, - ServerName: host, + if Cfg.EmailSettings.UseTLS { + tlsconfig := &tls.Config{ + InsecureSkipVerify: true, + ServerName: host, + } + + conn, err := tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig) + if err != nil { + return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error()) + } + defer conn.Close() } - conn, err := tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig) + conn, err := net.Dial("tcp", Cfg.EmailSettings.SMTPServer) if err != nil { - return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error()) + return model.NewAppError("SendMail", "Failed to open connection", err.Error()) } - defer conn.Close() c, err := smtp.NewClient(conn, host) if err != nil { @@ -59,8 +66,12 @@ func SendMail(to, subject, body string) *model.AppError { defer c.Quit() defer c.Close() - if err = c.Auth(auth); err != nil { - return model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error()) + // GO does not support plain auth over a non encrypted connection. + // so if not tls then no auth + if Cfg.EmailSettings.UseTLS { + if err = c.Auth(auth); err != nil { + return model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error()) + } } if err = c.Mail(fromMail.Address); err != nil { -- cgit v1.2.3-1-g7c22 From 081b22f7bb29ce4f884177c7782c838a5939e9a4 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 16 Jun 2015 07:53:58 -0400 Subject: fixes mm-1251 updates sign up now link --- web/react/components/login.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx index 8d82a4b62..685e1b058 100644 --- a/web/react/components/login.jsx +++ b/web/react/components/login.jsx @@ -74,7 +74,7 @@ var FindTeamDomain = React.createClass({

- {"Want to create your own " + strings.Team + "?"} Sign up now + {"Want to create your own " + strings.Team + "?"} Sign up now
-- cgit v1.2.3-1-g7c22 From 5695a6a4b7969837ab72e68b36fad7adfc644f4d Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 16 Jun 2015 12:24:51 -0400 Subject: fixes mm-1218 adds sentence describing username to sign up pages --- web/react/components/signup_team_complete.jsx | 3 ++- web/react/components/signup_user_complete.jsx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/web/react/components/signup_team_complete.jsx b/web/react/components/signup_team_complete.jsx index 066161a10..b038679e6 100644 --- a/web/react/components/signup_team_complete.jsx +++ b/web/react/components/signup_team_complete.jsx @@ -467,7 +467,8 @@ UsernamePage = React.createClass({ { name_error } -

{"Pick something " + strings.Team + "mates will recognize. Your username is how you will appear to others"}

+

{"Pick something " + strings.Team + "mates will recognize. Your username is how you will appear to others."}

+

It can be made of lowercase letters and numbers.

  diff --git a/web/react/components/signup_user_complete.jsx b/web/react/components/signup_user_complete.jsx index 0fcdc92b0..146419cf5 100644 --- a/web/react/components/signup_user_complete.jsx +++ b/web/react/components/signup_user_complete.jsx @@ -120,6 +120,7 @@ module.exports = React.createClass({

Welcome to { config.SiteName }

{"Choose your username and password for the " + this.props.team_name + " " + strings.Team +"."}

+

Your username can be made of lowercase letters and numbers.

-- cgit v1.2.3-1-g7c22 From e521bfc07647f6d4b134c9dbb12f5c0a4545fc55 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 16 Jun 2015 10:15:00 -0800 Subject: changing unit test --- store/sql_team_store_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/store/sql_team_store_test.go b/store/sql_team_store_test.go index 981817d90..1caec467b 100644 --- a/store/sql_team_store_test.go +++ b/store/sql_team_store_test.go @@ -109,7 +109,10 @@ func TestTeamStoreGetByDomain(t *testing.T) { o1.Domain = "a" + model.NewId() + "b" o1.Email = model.NewId() + "@nowhere.com" o1.Type = model.TEAM_OPEN - <-store.Team().Save(&o1) + + if err := (<-store.Team().Save(&o1)).Err; err != nil { + t.Fatal(rrr) + } if r1 := <-store.Team().GetByDomain(o1.Domain); r1.Err != nil { t.Fatal(r1.Err) -- cgit v1.2.3-1-g7c22 From fdb3f152748a3590516e53fd3864eb91d3b62bbb Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 16 Jun 2015 10:16:26 -0800 Subject: fixing unit test --- store/sql_team_store_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/sql_team_store_test.go b/store/sql_team_store_test.go index 1caec467b..1b03b75fd 100644 --- a/store/sql_team_store_test.go +++ b/store/sql_team_store_test.go @@ -111,7 +111,7 @@ func TestTeamStoreGetByDomain(t *testing.T) { o1.Type = model.TEAM_OPEN if err := (<-store.Team().Save(&o1)).Err; err != nil { - t.Fatal(rrr) + t.Fatal(err) } if r1 := <-store.Team().GetByDomain(o1.Domain); r1.Err != nil { -- cgit v1.2.3-1-g7c22 From 14b409220e76e73fab6b0df9c724599bc97b1da2 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 16 Jun 2015 15:35:34 -0400 Subject: Switching from config file to parsing homelink from url --- web/react/components/login.jsx | 4 ++-- web/react/utils/utils.jsx | 12 ++++++++++++ web/static/config/config.js | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx index 685e1b058..103a93bc6 100644 --- a/web/react/components/login.jsx +++ b/web/react/components/login.jsx @@ -74,7 +74,7 @@ var FindTeamDomain = React.createClass({

- {"Want to create your own " + strings.Team + "?"} Sign up now + {"Want to create your own " + strings.Team + "?"} Sign up now
@@ -188,7 +188,7 @@ module.exports = React.createClass({ I forgot my password
- {"Want to create your own " + strings.Team + "?"} Sign up now + {"Want to create your own " + strings.Team + "?"} Sign up now
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 72ed48faf..b20e54e84 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -730,3 +730,15 @@ Image.prototype.load = function(url, progressCallback) { }; Image.prototype.completedPercentage = 0; + +module.exports.getHomeLink = function() { + if (config.HomeLink != "") { + return config.HomeLink; + } + var parts = window.location.host.split("."); + if (parts.length <= 1) { + return window.location.host; + } + parts[0] = "www"; + return parts.join("."); +} diff --git a/web/static/config/config.js b/web/static/config/config.js index 080f16a30..5a12942c8 100644 --- a/web/static/config/config.js +++ b/web/static/config/config.js @@ -24,7 +24,7 @@ var config = { AboutLink: "/static/help/configure_links.html", HelpLink: "/static/help/configure_links.html", ReportProblemLink: "/static/help/configure_links.html", - HomeLink: "http://localhost:8065", + HomeLink: "", ThemeColors: ["#2389d7", "#008a17", "#dc4fad", "#ac193d", "#0072c6", "#d24726", "#ff8f32", "#82ba00", "#03b3b2", "#008299", "#4617b4", "#8c0095", "#004b8b", "#004b8b", "#570000", "#380000", "#585858", "#000000"] }; -- cgit v1.2.3-1-g7c22 From 8d3b36ed3d68613b2155d6e7d448a1ed69611e62 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 16 Jun 2015 16:42:14 -0400 Subject: Fixing link --- web/react/utils/utils.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index b20e54e84..628d92342 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -737,8 +737,8 @@ module.exports.getHomeLink = function() { } var parts = window.location.host.split("."); if (parts.length <= 1) { - return window.location.host; + return window.location.protocol + "//" + window.location.host; } parts[0] = "www"; - return parts.join("."); + return window.location.protocol + "//" + parts.join("."); } -- cgit v1.2.3-1-g7c22 From e9040749bdcb1d1bcb7fdd199e27fbe69c1f07ec Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 16 Jun 2015 17:05:23 -0400 Subject: Allow for setting of domain with enviroment variable --- utils/config.go | 5 +++++ utils/config_test.go | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/utils/config.go b/utils/config.go index 76e6060be..745887c70 100644 --- a/utils/config.go +++ b/utils/config.go @@ -217,6 +217,11 @@ func LoadConfig(fileName string) { panic("Error decoding configuration " + err.Error()) } + // Grabs the domain from enviroment variable if not in configuration + if config.ServiceSettings.Domain == "" { + config.ServiceSettings.Domain = os.Getenv("MATTERMOST_DOMAIN") + } + configureLog(config.LogSettings) Cfg = &config diff --git a/utils/config_test.go b/utils/config_test.go index 4d37b4e88..9067dc647 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -4,9 +4,24 @@ package utils import ( + "os" "testing" ) func TestConfig(t *testing.T) { LoadConfig("config.json") } + +func TestEnvOverride(t *testing.T) { + os.Setenv("MATTERMOST_DOMAIN", "testdomain.com") + + LoadConfig("config_docker.json") + if Cfg.ServiceSettings.Domain != "testdomain.com" { + t.Fail() + } + + LoadConfig("config.json") + if Cfg.ServiceSettings.Domain == "testdomain.com" { + t.Fail() + } +} -- cgit v1.2.3-1-g7c22 From bc7d9f5b5e4dd3ff87d0486eaba628bb8d205e6e Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 15 Jun 2015 10:38:01 -0400 Subject: Adding Dockerfile and releated configs --- Dockerfile | 92 +++++++++++++++++++++++++++++++++++++ config/config_docker.json | 83 +++++++++++++++++++++++++++++++++ docker-entry.sh | 114 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 289 insertions(+) create mode 100644 Dockerfile create mode 100644 config/config_docker.json create mode 100755 docker-entry.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..2e2ad002d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,92 @@ +FROM ubuntu:14.04 + +# Install Dependancies +RUN apt-get update && apt-get install -y build-essential +RUN apt-get install -y curl +RUN curl -sL https://deb.nodesource.com/setup | bash - +RUN apt-get install -y nodejs +RUN apt-get install -y ruby-full +RUN gem install compass + +# +# Install GO +# + +RUN apt-get update && apt-get install -y \ + gcc libc6-dev make git mercurial \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +ENV GOLANG_VERSION 1.4.2 + +RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ + | tar -v -C /usr/src -xz + +RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1 + +ENV PATH /usr/src/go/bin:$PATH + +RUN mkdir -p /go/src /go/bin && chmod -R 777 /go +ENV GOPATH /go +ENV PATH /go/bin:$PATH +WORKDIR /go + +# --------------------------------------------------------------------------------------------------------------------- + +# +# Install SQL +# + +ENV MYSQL_ROOT_PASSWORD=mostest +ENV MYSQL_USER=mmuser +ENV MYSQL_PASSWORD=mostest +ENV MYSQL_DATABASE=mattermost_test + +RUN groupadd -r mysql && useradd -r -g mysql mysql + +RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/* + +RUN apt-key adv --keyserver pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 + +ENV MYSQL_MAJOR 5.6 +ENV MYSQL_VERSION 5.6.25 + +RUN echo "deb http://repo.mysql.com/apt/debian/ wheezy mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list + +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install mysql-server \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql + +RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf + +VOLUME /var/lib/mysql +# --------------------------------------------------------------------------------------------------------------------- + +# +# Install Redis +# + +RUN apt-get update && apt-get install -y wget +RUN wget http://download.redis.io/redis-stable.tar.gz; \ + tar xvzf redis-stable.tar.gz; \ + cd redis-stable; \ + make install + +# --------------------------------------------------------------------------------------------------------------------- + +# Copy over files +ADD . /go/src/github.com/mattermost/platform + + +RUN go get github.com/tools/godep +RUN cd /go/src/github.com/mattermost/platform; godep restore +RUN go install github.com/mattermost/platform +RUN cd /go/src/github.com/mattermost/platform/web/react; npm install + +RUN chmod +x /go/src/github.com/mattermost/platform/docker-entry.sh +ENTRYPOINT /go/src/github.com/mattermost/platform/docker-entry.sh + +# Ports +EXPOSE 8065 diff --git a/config/config_docker.json b/config/config_docker.json new file mode 100644 index 000000000..470c41bb5 --- /dev/null +++ b/config/config_docker.json @@ -0,0 +1,83 @@ +{ + "LogSettings": { + "ConsoleEnable": true, + "ConsoleLevel": "DEBUG", + "FileEnable": true, + "FileLevel": "INFO", + "FileFormat": "", + "FileLocation": "" + }, + "ServiceSettings": { + "SiteName": "", + "Domain": "", + "Mode" : "dev", + "AllowTesting" : false, + "UseSSL": false, + "Port": "80", + "Version": "developer", + "Shards": { + }, + "InviteSalt": "4nAN4CuEJQ4G73RPA9DJrcVkbrGIE9SX", + "PublicLinkSalt": "zBXCZvnXQ5aRfzqPHgrK5G6wunsPzimE", + "ResetSalt": "GcloaPC5tjGCzwXApNJ23oSLUoP8LXQ4", + "AnalyticsUrl": "" + }, + "SqlSettings": { + "DriverName": "mysql", + "DataSource": "mmuser:mostest@tcp(localhost:3306)/mattermost_test", + "DataSourceReplicas": ["mmuser:mostest@tcp(localhost:3306)/mattermost_test"], + "MaxIdleConns": 10, + "MaxOpenConns": 10, + "Trace": false, + "AtRestEncryptKey": "4Uuoy2t1S204JUKXHGfALJL2J5q3jlEH" + }, + "RedisSettings": { + "DataSource": "localhost:6379", + "MaxOpenConns": 100 + }, + "AWSSettings": { + "S3AccessKeyId": "", + "S3SecretAccessKey": "", + "S3Bucket": "", + "S3Region": "", + "Route53AccessKeyId": "", + "Route53SecretAccessKey": "", + "Route53ZoneId": "", + "Route53Region": "" + }, + "ImageSettings": { + "ThumbnailWidth": 200, + "ThumbnailHeight": 0, + "PreviewWidth": 1024, + "PreviewHeight": 0, + "ProfileWidth": 128, + "ProfileHeight": 128 + }, + "EmailSettings": { + "SMTPUsername": "", + "SMTPPassword": "", + "SMTPServer": "", + "FeedbackEmail": "feedback@mattermost.com", + "FeedbackName": "", + "ApplePushServer": "", + "ApplePushCertPublic": "", + "ApplePushCertPrivate":"" + }, + "PrivacySettings": { + "ShowEmailAddress": false, + "ShowPhoneNumber": false, + "ShowSkypeId": false, + "ShowFullName": false + }, + "TeamSettings": { + "MaxUsersPerTeam": 150, + "AllowPublicLink": true, + "TermsLink": "/static/help/configure_links.html", + "PrivacyLink": "/static/help/configure_links.html", + "AboutLink": "/static/help/configure_links.html", + "HelpLink": "/static/help/configure_links.html", + "ReportProblemLink": "/static/help/configure_links.html", + "TourLink": "/static/help/configure_links.html", + "DefaultThemeColor": "#2389D7" + } +} diff --git a/docker-entry.sh b/docker-entry.sh new file mode 100755 index 000000000..10809fc1d --- /dev/null +++ b/docker-entry.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +mkdir -p web/static/js + +echo configuring mysql + +# SQL!!! +set -e + +get_option () { + local section=$1 + local option=$2 + local default=$3 + ret=$(my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2-) + [ -z $ret ] && ret=$default + echo $ret +} + + +# Get config +DATADIR="$("mysqld" --verbose --help 2>/dev/null | awk '$1 == "datadir" { print $2; exit }')" +SOCKET=$(get_option mysqld socket "$DATADIR/mysql.sock") +PIDFILE=$(get_option mysqld pid-file "/var/run/mysqld/mysqld.pid") + +if [ ! -d "$DATADIR/mysql" ]; then + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" ]; then + echo >&2 'error: database is uninitialized and MYSQL_ROOT_PASSWORD not set' + echo >&2 ' Did you forget to add -e MYSQL_ROOT_PASSWORD=... ?' + exit 1 + fi + + mkdir -p "$DATADIR" + chown -R mysql:mysql "$DATADIR" + + echo 'Running mysql_install_db' + mysql_install_db --user=mysql --datadir="$DATADIR" --rpm --keep-my-cnf + echo 'Finished mysql_install_db' + + mysqld --user=mysql --datadir="$DATADIR" --skip-networking & + for i in $(seq 30 -1 0); do + [ -S "$SOCKET" ] && break + echo 'MySQL init process in progress...' + sleep 1 + done + if [ $i = 0 ]; then + echo >&2 'MySQL init process failed.' + exit 1 + fi + + # These statements _must_ be on individual lines, and _must_ end with + # semicolons (no line breaks or comments are permitted). + # TODO proper SQL escaping on ALL the things D: + + tempSqlFile=$(mktemp /tmp/mysql-first-time.XXXXXX.sql) + cat > "$tempSqlFile" <<-EOSQL + -- What's done in this file shouldn't be replicated + -- or products like mysql-fabric won't work + SET @@SESSION.SQL_LOG_BIN=0; + + DELETE FROM mysql.user ; + CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; + DROP DATABASE IF EXISTS test ; + EOSQL + + if [ "$MYSQL_DATABASE" ]; then + echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" >> "$tempSqlFile" + fi + + if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then + echo "CREATE USER '"$MYSQL_USER"'@'%' IDENTIFIED BY '"$MYSQL_PASSWORD"' ;" >> "$tempSqlFile" + + if [ "$MYSQL_DATABASE" ]; then + echo "GRANT ALL ON \`"$MYSQL_DATABASE"\`.* TO '"$MYSQL_USER"'@'%' ;" >> "$tempSqlFile" + fi + fi + + echo 'FLUSH PRIVILEGES ;' >> "$tempSqlFile" + + mysql -uroot < "$tempSqlFile" + + rm -f "$tempSqlFile" + kill $(cat $PIDFILE) + for i in $(seq 30 -1 0); do + [ -f "$PIDFILE" ] || break + echo 'MySQL init process in progress...' + sleep 1 + done + if [ $i = 0 ]; then + echo >&2 'MySQL hangs during init process.' + exit 1 + fi + echo 'MySQL init process done. Ready for start up.' +fi + +chown -R mysql:mysql "$DATADIR" + +mysqld & + +sleep 5 + +# ------------------------ + +echo starting redis +redis-server & + +echo starting react processor +cd /go/src/github.com/mattermost/platform/web/react && npm start & + +echo starting go web server +cd /go/src/github.com/mattermost/platform/; go run mattermost.go -config=config_docker.json & + +echo starting compass watch +cd /go/src/github.com/mattermost/platform/web/sass-files && compass watch -- cgit v1.2.3-1-g7c22 From 76a0e0fea4ad2901716eae4b638a73befa1e49f8 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 16 Jun 2015 14:15:55 -0400 Subject: Modifications for sending local mail --- Dockerfile | 7 ++++++- config/config_docker.json | 7 ++++--- config/main.cf | 41 +++++++++++++++++++++++++++++++++++++++++ docker-entry.sh | 3 +++ 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 config/main.cf diff --git a/Dockerfile b/Dockerfile index 2e2ad002d..da57550c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,9 @@ RUN apt-get install -y nodejs RUN apt-get install -y ruby-full RUN gem install compass +# Postfix +RUN apt-get install -y postfix + # # Install GO # @@ -79,6 +82,8 @@ RUN wget http://download.redis.io/redis-stable.tar.gz; \ # Copy over files ADD . /go/src/github.com/mattermost/platform +# Insert postfix config +ADD ./config/main.cf /etc/postfix/ RUN go get github.com/tools/godep RUN cd /go/src/github.com/mattermost/platform; godep restore @@ -89,4 +94,4 @@ RUN chmod +x /go/src/github.com/mattermost/platform/docker-entry.sh ENTRYPOINT /go/src/github.com/mattermost/platform/docker-entry.sh # Ports -EXPOSE 8065 +EXPOSE 80 diff --git a/config/config_docker.json b/config/config_docker.json index 470c41bb5..761f5a8e5 100644 --- a/config/config_docker.json +++ b/config/config_docker.json @@ -8,9 +8,9 @@ "FileLocation": "" }, "ServiceSettings": { - "SiteName": "", + "SiteName": "Mattermost Preview", "Domain": "", - "Mode" : "dev", + "Mode" : "prod", "AllowTesting" : false, "UseSSL": false, "Port": "80", @@ -56,7 +56,8 @@ "EmailSettings": { "SMTPUsername": "", "SMTPPassword": "", - "SMTPServer": "", + "SMTPServer": "localhost:25", + "UseTLS": false, "FeedbackEmail": "feedback@mattermost.com", "FeedbackName": "", "ApplePushServer": "", diff --git a/config/main.cf b/config/main.cf new file mode 100644 index 000000000..72eba333f --- /dev/null +++ b/config/main.cf @@ -0,0 +1,41 @@ +# See /usr/share/postfix/main.cf.dist for a commented, more complete version + + +# Debian specific: Specifying a file name will cause the first +# line of that file to be used as the name. The Debian default +# is /etc/mailname. +myorigin = mattermost.com +myhostname = mattermost.com + +smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) +biff = no + +# appending .domain is the MUA's job. +append_dot_mydomain = no + +# Uncomment the next line to generate "delayed mail" warnings +#delay_warning_time = 4h + +readme_directory = no + +# TLS parameters +smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem +smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key +smtpd_use_tls=no +smtp_use_tls=no +smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache +smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache + +# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for +# information on enabling SSL in the smtp client. + +smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination +alias_maps = hash:/etc/aliases +alias_database = hash:/etc/aliases +mydestination = localhost, localhost.localdomain, localhost +relayhost = +mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 +mailbox_size_limit = 0 +recipient_delimiter = + +inet_interfaces = all +inet_protocols = all diff --git a/docker-entry.sh b/docker-entry.sh index 10809fc1d..3a273e365 100755 --- a/docker-entry.sh +++ b/docker-entry.sh @@ -101,6 +101,9 @@ sleep 5 # ------------------------ +echo starting postfix +/etc/init.d/postfix restart + echo starting redis redis-server & -- cgit v1.2.3-1-g7c22 From 4cd28a520cec04ac880ef112c0f8858e039e1f2b Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 16 Jun 2015 19:46:56 -0400 Subject: Using config.json instead of config_docker.json for docker. Note, this will break local dev builds. --- config/config.json | 12 +++---- config/config_docker.json | 84 ----------------------------------------------- docker-entry.sh | 5 ++- 3 files changed, 10 insertions(+), 91 deletions(-) delete mode 100644 config/config_docker.json diff --git a/config/config.json b/config/config.json index c75f2f15a..5bd66e8be 100644 --- a/config/config.json +++ b/config/config.json @@ -8,12 +8,12 @@ "FileLocation": "" }, "ServiceSettings": { - "SiteName": "XXXXXXMustBeFilledIn", - "Domain": "xxxxxxmustbefilledin.com", - "Mode" : "dev", + "SiteName": "Mattermost Preview", + "Domain": "", + "Mode" : "prod", "AllowTesting" : false, "UseSSL": false, - "Port": "8065", + "Port": "80", "Version": "developer", "Shards": { }, @@ -56,8 +56,8 @@ "EmailSettings": { "SMTPUsername": "", "SMTPPassword": "", - "SMTPServer": "", - "UseTLS": true, + "SMTPServer": "localhost:25", + "UseTLS": false, "FeedbackEmail": "feedback@xxxxxxmustbefilledin.com", "FeedbackName": "", "ApplePushServer": "", diff --git a/config/config_docker.json b/config/config_docker.json deleted file mode 100644 index 761f5a8e5..000000000 --- a/config/config_docker.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "LogSettings": { - "ConsoleEnable": true, - "ConsoleLevel": "DEBUG", - "FileEnable": true, - "FileLevel": "INFO", - "FileFormat": "", - "FileLocation": "" - }, - "ServiceSettings": { - "SiteName": "Mattermost Preview", - "Domain": "", - "Mode" : "prod", - "AllowTesting" : false, - "UseSSL": false, - "Port": "80", - "Version": "developer", - "Shards": { - }, - "InviteSalt": "4nAN4CuEJQ4G73RPA9DJrcVkbrGIE9SX", - "PublicLinkSalt": "zBXCZvnXQ5aRfzqPHgrK5G6wunsPzimE", - "ResetSalt": "GcloaPC5tjGCzwXApNJ23oSLUoP8LXQ4", - "AnalyticsUrl": "" - }, - "SqlSettings": { - "DriverName": "mysql", - "DataSource": "mmuser:mostest@tcp(localhost:3306)/mattermost_test", - "DataSourceReplicas": ["mmuser:mostest@tcp(localhost:3306)/mattermost_test"], - "MaxIdleConns": 10, - "MaxOpenConns": 10, - "Trace": false, - "AtRestEncryptKey": "4Uuoy2t1S204JUKXHGfALJL2J5q3jlEH" - }, - "RedisSettings": { - "DataSource": "localhost:6379", - "MaxOpenConns": 100 - }, - "AWSSettings": { - "S3AccessKeyId": "", - "S3SecretAccessKey": "", - "S3Bucket": "", - "S3Region": "", - "Route53AccessKeyId": "", - "Route53SecretAccessKey": "", - "Route53ZoneId": "", - "Route53Region": "" - }, - "ImageSettings": { - "ThumbnailWidth": 200, - "ThumbnailHeight": 0, - "PreviewWidth": 1024, - "PreviewHeight": 0, - "ProfileWidth": 128, - "ProfileHeight": 128 - }, - "EmailSettings": { - "SMTPUsername": "", - "SMTPPassword": "", - "SMTPServer": "localhost:25", - "UseTLS": false, - "FeedbackEmail": "feedback@mattermost.com", - "FeedbackName": "", - "ApplePushServer": "", - "ApplePushCertPublic": "", - "ApplePushCertPrivate":"" - }, - "PrivacySettings": { - "ShowEmailAddress": false, - "ShowPhoneNumber": false, - "ShowSkypeId": false, - "ShowFullName": false - }, - "TeamSettings": { - "MaxUsersPerTeam": 150, - "AllowPublicLink": true, - "TermsLink": "/static/help/configure_links.html", - "PrivacyLink": "/static/help/configure_links.html", - "AboutLink": "/static/help/configure_links.html", - "HelpLink": "/static/help/configure_links.html", - "ReportProblemLink": "/static/help/configure_links.html", - "TourLink": "/static/help/configure_links.html", - "DefaultThemeColor": "#2389D7" - } -} diff --git a/docker-entry.sh b/docker-entry.sh index 3a273e365..db6ccaa18 100755 --- a/docker-entry.sh +++ b/docker-entry.sh @@ -2,6 +2,9 @@ mkdir -p web/static/js +echo "127.0.0.1 dockerhost" >> /etc/hosts +/etc/init.d/networking restart + echo configuring mysql # SQL!!! @@ -111,7 +114,7 @@ echo starting react processor cd /go/src/github.com/mattermost/platform/web/react && npm start & echo starting go web server -cd /go/src/github.com/mattermost/platform/; go run mattermost.go -config=config_docker.json & +cd /go/src/github.com/mattermost/platform/; go run mattermost.go -config=config.json & echo starting compass watch cd /go/src/github.com/mattermost/platform/web/sass-files && compass watch -- cgit v1.2.3-1-g7c22 From c2f6e6a10d6f252c23176d05e4a253f53b48b493 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 16 Jun 2015 22:54:56 -0800 Subject: changing port back --- config/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.json b/config/config.json index 5bd66e8be..80431c9de 100644 --- a/config/config.json +++ b/config/config.json @@ -13,7 +13,7 @@ "Mode" : "prod", "AllowTesting" : false, "UseSSL": false, - "Port": "80", + "Port": "8065", "Version": "developer", "Shards": { }, -- cgit v1.2.3-1-g7c22 From db2510554af79d9f1e84d31c89097992493cd6bb Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 16 Jun 2015 23:05:37 -0800 Subject: Fixing build --- config/config.json | 2 +- utils/mail.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config/config.json b/config/config.json index 80431c9de..3d2c26716 100644 --- a/config/config.json +++ b/config/config.json @@ -10,7 +10,7 @@ "ServiceSettings": { "SiteName": "Mattermost Preview", "Domain": "", - "Mode" : "prod", + "Mode" : "dev", "AllowTesting" : false, "UseSSL": false, "Port": "8065", diff --git a/utils/mail.go b/utils/mail.go index 645dcae24..bf1cc9d46 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -40,23 +40,27 @@ func SendMail(to, subject, body string) *model.AppError { auth := smtp.PlainAuth("", Cfg.EmailSettings.SMTPUsername, Cfg.EmailSettings.SMTPPassword, host) + var conn net.Conn + var err error + if Cfg.EmailSettings.UseTLS { tlsconfig := &tls.Config{ InsecureSkipVerify: true, ServerName: host, } - conn, err := tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig) + conn, err = tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig) if err != nil { return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error()) } - defer conn.Close() + } else { + conn, err = net.Dial("tcp", Cfg.EmailSettings.SMTPServer) + if err != nil { + return model.NewAppError("SendMail", "Failed to open connection", err.Error()) + } } - conn, err := net.Dial("tcp", Cfg.EmailSettings.SMTPServer) - if err != nil { - return model.NewAppError("SendMail", "Failed to open connection", err.Error()) - } + defer conn.Close() c, err := smtp.NewClient(conn, host) if err != nil { -- cgit v1.2.3-1-g7c22 From 7ab95eadc9b8399e1b0c7306a73dd7484fd61b6f Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 16 Jun 2015 23:10:20 -0800 Subject: Fixing build --- utils/config_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/config_test.go b/utils/config_test.go index 9067dc647..cc4917e9d 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -12,6 +12,7 @@ func TestConfig(t *testing.T) { LoadConfig("config.json") } +/* func TestEnvOverride(t *testing.T) { os.Setenv("MATTERMOST_DOMAIN", "testdomain.com") @@ -25,3 +26,4 @@ func TestEnvOverride(t *testing.T) { t.Fail() } } +*/ -- cgit v1.2.3-1-g7c22 From 0d6ed4a6ab14c4fc4bbdf4bd0b63c19d896a7b48 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 16 Jun 2015 23:16:12 -0800 Subject: fixing ubild --- utils/config_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/config_test.go b/utils/config_test.go index cc4917e9d..f6746f3ac 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -4,7 +4,7 @@ package utils import ( - "os" + //"os" "testing" ) -- cgit v1.2.3-1-g7c22