Commit 040ffe4636b3a8a38573b475d57229a21ac3a5de
Exists in
master
and in
64 other branches
Merge branch 'master' into gitlab_private_token
Showing
7 changed files
with
129 additions
and
13 deletions
Show diff stats
Vagrantfile
@@ -24,30 +24,30 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | @@ -24,30 +24,30 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
24 | end | 24 | end |
25 | 25 | ||
26 | config.vm.define 'database' do |database| | 26 | config.vm.define 'database' do |database| |
27 | - database.vm.provider "virtualbox" do |vm| | ||
28 | - database.vm.network 'private_network', ip: ips['database'] if ips | 27 | + database.vm.provider "virtualbox" do |vm, override| |
28 | + override.vm.network 'private_network', ip: ips['database'] if ips | ||
29 | end | 29 | end |
30 | end | 30 | end |
31 | config.vm.define 'integration' do |integration| | 31 | config.vm.define 'integration' do |integration| |
32 | - integration.vm.provider "virtualbox" do |vm| | ||
33 | - integration.vm.network 'private_network', ip: ips['integration'] if ips | 32 | + integration.vm.provider "virtualbox" do |vm, override| |
33 | + override.vm.network 'private_network', ip: ips['integration'] if ips | ||
34 | vm.memory = 1024 | 34 | vm.memory = 1024 |
35 | vm.cpus = 2 | 35 | vm.cpus = 2 |
36 | end | 36 | end |
37 | end | 37 | end |
38 | config.vm.define 'email' do |email| | 38 | config.vm.define 'email' do |email| |
39 | - email.vm.provider "virtualbox" do |vm| | ||
40 | - email.vm.network 'private_network', ip: ips['email'] if ips | 39 | + email.vm.provider "virtualbox" do |vm, override| |
40 | + override.vm.network 'private_network', ip: ips['email'] if ips | ||
41 | end | 41 | end |
42 | end | 42 | end |
43 | config.vm.define 'social' do |social| | 43 | config.vm.define 'social' do |social| |
44 | - social.vm.provider "virtualbox" do |vm| | ||
45 | - social.vm.network 'private_network', ip: ips['social'] if ips | 44 | + social.vm.provider "virtualbox" do |vm, override| |
45 | + override.vm.network 'private_network', ip: ips['social'] if ips | ||
46 | end | 46 | end |
47 | end | 47 | end |
48 | config.vm.define 'reverseproxy' do |reverseproxy| | 48 | config.vm.define 'reverseproxy' do |reverseproxy| |
49 | - reverseproxy.vm.provider "virtualbox" do |vm| | ||
50 | - reverseproxy.vm.network 'private_network', ip: ips['reverseproxy'] if ips | 49 | + reverseproxy.vm.provider "virtualbox" do |vm, override| |
50 | + override.vm.network 'private_network', ip: ips['reverseproxy'] if ips | ||
51 | end | 51 | end |
52 | if File.exist?("tmp/preconfig.#{env}.stamp") | 52 | if File.exist?("tmp/preconfig.#{env}.stamp") |
53 | reverseproxy.ssh.port = File.read("tmp/preconfig.#{env}.stamp").strip.to_i | 53 | reverseproxy.ssh.port = File.read("tmp/preconfig.#{env}.stamp").strip.to_i |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +upstream app_server { | ||
2 | + server 127.0.0.1:8080 fail_timeout=0; | ||
3 | +} | ||
4 | + | ||
5 | +server { | ||
6 | + listen 80; | ||
7 | + listen [::]:80 default ipv6only=on; | ||
8 | + server_name ci.spb.lappis; | ||
9 | + | ||
10 | + location / { | ||
11 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
12 | + proxy_set_header Host $http_host; | ||
13 | + proxy_redirect off; | ||
14 | + | ||
15 | + if (!-f $request_filename) { | ||
16 | + proxy_pass http://app_server; | ||
17 | + break; | ||
18 | + } | ||
19 | + } | ||
20 | +} | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
cookbooks/ci/recipes/default.rb
@@ -0,0 +1,61 @@ | @@ -0,0 +1,61 @@ | ||
1 | +JENKINS_CLI = '/var/cache/jenkins/war/WEB-INF/jenkins-cli.jar' | ||
2 | + | ||
3 | +execute 'jenkins_repo' do | ||
4 | + command 'wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | sudo apt-key add -' | ||
5 | +end | ||
6 | + | ||
7 | +execute 'apt_sources' do | ||
8 | + command 'echo "deb http://pkg.jenkins-ci.org/debian-stable binary/" >> /etc/apt/sources.list' | ||
9 | + not_if 'cat /etc/apt/sources.list | grep jenkins-ci' | ||
10 | +end | ||
11 | + | ||
12 | +execute 'apt-get update' | ||
13 | + | ||
14 | +package 'jenkins' | ||
15 | + | ||
16 | +service 'jenkins' do | ||
17 | + action :enable | ||
18 | +end | ||
19 | + | ||
20 | +execute 'service jenkins restart' | ||
21 | + | ||
22 | +package 'nginx' | ||
23 | + | ||
24 | +service 'nginx' do | ||
25 | + action [:enable, :start] | ||
26 | +end | ||
27 | + | ||
28 | +file '/etc/nginx/sites-available/default' do | ||
29 | + action :delete | ||
30 | +end | ||
31 | + | ||
32 | +cookbook_file 'nginx' do | ||
33 | + path '/etc/nginx/sites-available/jenkins' | ||
34 | +end | ||
35 | + | ||
36 | +file '/etc/nginx/sites-enabled/default' do | ||
37 | + action :delete | ||
38 | +end | ||
39 | + | ||
40 | +link '/etc/nginx/sites-enabled/jenkins' do | ||
41 | + to '/etc/nginx/sites-available/jenkins' | ||
42 | + not_if 'test -L /etc/nginx/sites-enabled/jenkins' | ||
43 | +end | ||
44 | + | ||
45 | +service 'nginx' do | ||
46 | + action :restart | ||
47 | +end | ||
48 | + | ||
49 | +package 'git' | ||
50 | + | ||
51 | +plugins = ['git-client', 'git-server', 'build-blocker-plugin', 'greenballs', 'view-job-filters', 'gitlab-plugin'] | ||
52 | + | ||
53 | +plugins.each do |plugin| | ||
54 | + execute "install jenkins plugin #{plugin}" do | ||
55 | + command "java -jar #{JENKINS_CLI} -s http://localhost/ install-plugin #{plugin}" | ||
56 | + retries 5 | ||
57 | + retry_delay 10 | ||
58 | + end | ||
59 | +end | ||
60 | + | ||
61 | +execute 'service jenkins restart' | ||
0 | \ No newline at end of file | 62 | \ No newline at end of file |
cookbooks/ci/recipes/spb.rb
@@ -10,6 +10,7 @@ package 'virtualbox' | @@ -10,6 +10,7 @@ package 'virtualbox' | ||
10 | 10 | ||
11 | package 'vagrant' | 11 | package 'vagrant' |
12 | package 'rake' | 12 | package 'rake' |
13 | +package 'shunit2' | ||
13 | 14 | ||
14 | # FIXME not in the archive yet | 15 | # FIXME not in the archive yet |
15 | # package 'chake' | 16 | # package 'chake' |
cookbooks/mailman/templates/centos/mm_cfg.py.erb
@@ -16,11 +16,11 @@ except: | @@ -16,11 +16,11 @@ except: | ||
16 | # site-specific items | 16 | # site-specific items |
17 | ############################################################### | 17 | ############################################################### |
18 | 18 | ||
19 | -DEFAULT_URL_HOST = '<%= node['config']['external_hostname'] %>' | 19 | +DEFAULT_URL_HOST = '<%= node['config']['lists_hostname'] %>' |
20 | DEFAULT_EMAIL_HOST = '<%= node['config']['lists_hostname'] %>' | 20 | DEFAULT_EMAIL_HOST = '<%= node['config']['lists_hostname'] %>' |
21 | MTA = None | 21 | MTA = None |
22 | POSTFIX_STYLE_VIRTUAL_DOMAINS = ['<%= node['config']['lists_hostname']%>'] | 22 | POSTFIX_STYLE_VIRTUAL_DOMAINS = ['<%= node['config']['lists_hostname']%>'] |
23 | -DEFAULT_URL_PATTERN = 'http://%s/mailman/cgi-bin/' | 23 | +DEFAULT_URL_PATTERN = 'https://%s/mailman/cgi-bin/' |
24 | 24 | ||
25 | ############################################################### | 25 | ############################################################### |
26 | # copied from default mailman config file | 26 | # copied from default mailman config file |
docs/implantacao.rst.in
@@ -56,11 +56,31 @@ Preparação dos servidores | @@ -56,11 +56,31 @@ Preparação dos servidores | ||
56 | * Os servidores precisam estar acessíveis por SSH. Caso necessário, | 56 | * Os servidores precisam estar acessíveis por SSH. Caso necessário, |
57 | podem ser feitas configurações do SSH em | 57 | podem ser feitas configurações do SSH em |
58 | ``config/@@SPB_ENV@@/ssh_config`` para isso. | 58 | ``config/@@SPB_ENV@@/ssh_config`` para isso. |
59 | + | ||
59 | * O usuário que vai conectar via SSH nos servidores precisa: | 60 | * O usuário que vai conectar via SSH nos servidores precisa: |
60 | 61 | ||
61 | - * ter acesso SSH configurado via chave SSH para evitar digitar senha. | ||
62 | * ter permissão de usar ``sudo`` sem a necessidade de digitar senha. | 62 | * ter permissão de usar ``sudo`` sem a necessidade de digitar senha. |
63 | 63 | ||
64 | + * ter acesso SSH configurado via chave SSH para evitar digitar senha, | ||
65 | + a partir da estação de trabalho utilizada. Ou seja, a chave pública | ||
66 | + SSH **da estação de trabalho** deve ser copiada para cada servidor, | ||
67 | + e.g.:: | ||
68 | + | ||
69 | + $ ssh-copy-id reverseproxy | ||
70 | + $ ssh-copy-id integration | ||
71 | + $ ssh-copy-id social | ||
72 | + $ ssh-copy-id database | ||
73 | + $ ssh-copy-id email | ||
74 | + | ||
75 | +* O ``sudo`` não deve estar configurado com a opção ``requiretty``. Se | ||
76 | + houver uma linha como a seguinte em ``/etc/sudoers``, ela deve ser | ||
77 | + removida (ou comentada, como preferir):: | ||
78 | + | ||
79 | + $ Defaults requiretty | ||
80 | + | ||
81 | +* A máquina ``integration`` precisa ter o utilitário ``netcat``. No | ||
82 | + CentOS 7, pode ser instalado o pacote ``nmap-ncat``. | ||
83 | + | ||
64 | Configuração do ambiente alvo | 84 | Configuração do ambiente alvo |
65 | ----------------------------- | 85 | ----------------------------- |
66 | 86 | ||
@@ -233,3 +253,16 @@ muito mais simples:: | @@ -233,3 +253,16 @@ muito mais simples:: | ||
233 | 253 | ||
234 | Todas as possibilidades de comandos serão listados se você executar | 254 | Todas as possibilidades de comandos serão listados se você executar |
235 | ``rake -T``. Consulte também a documentação do chake_. | 255 | ``rake -T``. Consulte também a documentação do chake_. |
256 | + | ||
257 | + | ||
258 | +Atualizações | ||
259 | +------------ | ||
260 | + | ||
261 | +Para atualizar o sistema, primeiro atualize o repositório de gestão de | ||
262 | +configuração:: | ||
263 | + | ||
264 | + $ git pull | ||
265 | + | ||
266 | +Após isso, basta executar o comando ``converge`` novamente:: | ||
267 | + | ||
268 | + $ rake converge SPB_ENV=@@SPB_ENV@@ |