Commit 2ace09602e3061f0968bc951b583ffdbc4642740

Authored by Antonio Terceiro
1 parent 8a429d26
Exists in master and in 90 other branches 3.x, add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup, backup_not_prod, cdtc_configuration, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev-lappis, dev_env_minimal, disable_email_dev, docs, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, performance, prezento, r3, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_backup_emails, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, stable-devel, support_docs, syslog, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Automate a development mailman setup

vagrant.d/00-colab
... ... @@ -1,7 +0,0 @@
1   -#!/bin/sh
2   -
3   -set -e
4   -
5   -# colab
6   -/vagrant/colab/vagrant/bootstrap.sh
7   -sudo -u vagrant -i /vagrant/colab/vagrant/provision.sh
vagrant.d/00-colab-generic 0 → 100755
... ... @@ -0,0 +1,7 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +# colab
  6 +/vagrant/colab/vagrant/bootstrap.sh
  7 +sudo -u vagrant -i /vagrant/colab/vagrant/provision.sh
... ...
vagrant.d/10-mailman-debian 0 → 100755
... ... @@ -0,0 +1,98 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +export DEBIAN_FRONTEND=noninteractive
  6 +
  7 +if [ ! -f /etc/apt/sources.list.d/mailman-api.list ]; then
  8 + cat > /etc/apt/sources.list.d/mailman-api.list <<EOF
  9 +deb http://download.opensuse.org/repositories/isv:/spb:/mailman-api/Debian_7.0/ ./
  10 +deb-src http://download.opensuse.org/repositories/isv:/spb:/mailman-api/Debian_7.0/ ./
  11 +EOF
  12 +
  13 + apt-key add - <<EOF
  14 +-----BEGIN PGP PUBLIC KEY BLOCK-----
  15 +Version: GnuPG v2.0.15 (GNU/Linux)
  16 +
  17 +mQENBFRE9cMBCADl9VaZi3A4u5Fy2X9FP/18xkz2U1hsklLTgvwSuFT4gDCgtvD4
  18 +r3xAxnZ/52yLdAnrBratM1uC03WWifrCE+J5rImhiwP3itUzAGi/chmfVAuMBAVN
  19 +7rjBpurQoEuMDwec60XmS9XJ+BrcO+MyKaLTxKwy1KN+vaIM8Z7evpFdZghXwbL6
  20 +17ENLRbvqVs7gNtiyLQb26mNMRxTzp7vGFn4Vm2b73GrKvPC4nnUBA5FYZkSclk2
  21 +gpYt/QSZ7qj/YQZmzx31YSSRB8BOPGlsXV2ShWTzvVXfQoZ//ViDgYUlwh5hmaJo
  22 +f1gG6MumwJOdcfGlS2BOkddcYpNTveQ4HNQdABEBAAG0MGlzdjpzcGIgT0JTIFBy
  23 +b2plY3QgPGlzdjpzcGJAYnVpbGQub3BlbnN1c2Uub3JnPokBPgQTAQIAKAUCVET1
  24 +wwIbAwUJBB6wAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQE7yUxPVcdQmz
  25 +yAf/VIWhDdhOnF6XsR/USY57T1gYxFP3H+KchlCfvyFRc3lczZaDVQ57WkYlw7/2
  26 +TN2TpN6JMHPbmltD0QuQg9GSulgp1A5A6R9yWolcZ0QLkSndHcjQciZ4hHcrqO+C
  27 +Yb8fCMFJfejJ5FcTEVCBQgnazgI9qRyPAhEFZF3OCgQ1XOoaufojPGoKYoNXBOGI
  28 +g2phdVE1glq6ZesKMagoFURGf4pm/Muq5pjK0DbF/iVOM9uVGDWLLpfVMicYiHSF
  29 +YbqundUK6MzFlwuLSM0lXYuaaOF6rN3Gq03FVjNE5jbCUxJZAHSYF8KLZ57Opr8R
  30 +KVogKh7j5fixFpDoydcPkS0Md4hGBBMRAgAGBQJURPXDAAoJEDswEbdrnWUjeLkA
  31 +oKdP1tDhp1FzMFX+MTvEM/HyupveAKCHai4jMDBsjsoVJDobCws7IBLa3g==
  32 +=v9lx
  33 +-----END PGP PUBLIC KEY BLOCK-----
  34 +EOF
  35 + apt-get update
  36 +fi
  37 +
  38 +# pre-configure postfix
  39 +'debconf-set-selections' <<EOF
  40 +postfix postfix/main_mailer_type select Internet Site
  41 +EOF
  42 +
  43 +apt-get install -qy postfix mailman mailman-api
  44 +
  45 +LISTS_DOMAIN=lists.local
  46 +
  47 +#################################################################
  48 +# mailman-api configuration
  49 +#################################################################
  50 +
  51 +# FIXME binding to 0.0.0.0 is too liberal
  52 +cat > /etc/default/mailman-api <<EOF
  53 +OPTIONS='--bind=0.0.0.0:8010'
  54 +EOF
  55 +service mailman-api restart
  56 +
  57 +if ! grep -q MAILMAN_API_URL /etc/colab/settings.yaml; then
  58 + echo "MAILMAN_API_URL: 'http://localhost:8010'" >> /etc/colab/settings.yaml
  59 +fi
  60 +
  61 +#################################################################
  62 +# mailman configuration
  63 +#################################################################
  64 +
  65 +mailman_config() {
  66 + local key="$1"
  67 + local value="$2"
  68 + local conffile=/etc/mailman/mm_cfg.py
  69 + if grep -q "^$key\s*=" $conffile; then
  70 + sed -i -e "s/^$key\s*=.*/$key = $value/" $conffile
  71 + else
  72 + echo "$key = $value" >> $conffile
  73 + fi
  74 +}
  75 +
  76 +mailman_config DEFAULT_EMAIL_HOST "'$LISTS_DOMAIN'"
  77 +mailman_config MTA None
  78 +mailman_config POSTFIX_STYLE_VIRTUAL_DOMAINS "['$LISTS_DOMAIN']"
  79 +mailman_config DEB_LISTMASTER "'vagrant@localhost.localdomain'"
  80 +
  81 +# create some sample lists
  82 +for list in list01 list02 list03; do
  83 + if list_lists --bare | grep "$list"; then
  84 + echo "$list already exists ..."
  85 + else
  86 + newlist "$list" vagrant@localhost.localdomain "pass-$list"
  87 + echo 'vagrant@localhost.localdomain' | add_members -r - "$list"
  88 + fi
  89 +done
  90 +
  91 +#################################################################
  92 +# postfix configuration
  93 +#################################################################
  94 +postconf relay_domains="$LISTS_DOMAIN"
  95 +postconf transport_maps=hash:/etc/postfix/transport
  96 +echo "$LISTS_DOMAIN mailman:" > /etc/postfix/transport
  97 +postmap /etc/postfix/transport
  98 +service postfix restart
... ...
vagrant.sh
... ... @@ -2,4 +2,12 @@
2 2  
3 3 set -e
4 4  
5   -run-parts --exit-on-error /vagrant/vagrant.d
  5 +if [ -x /usr/bin/apt-get ]; then
  6 + regex='debian|generic'
  7 +fi
  8 +
  9 +if [ -x /usr/bin/yum ]; then
  10 + regex='centos|generic'
  11 +fi
  12 +
  13 +run-parts --exit-on-error --regex="$regex" /vagrant/vagrant.d
... ...