Commit dfbf2427a62f4545fe63495a972e125b59572d98

Authored by Antonio Terceiro
1 parent e4e36391

Unified release process

Makefile 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +%:
  2 + $(MAKE) -C src/ $@
... ...
README.chef.md 0 → 100644
... ... @@ -0,0 +1,96 @@
  1 +# Software Público - configuration management
  2 +
  3 +## Requirements
  4 +
  5 +* [chake](https://rubygems.org/gems/chake)
  6 +* rake
  7 +
  8 +For development
  9 +
  10 +* vagrant
  11 +* shunit2
  12 +* moreutils
  13 +* redir
  14 +
  15 +## Configuration parameters
  16 +
  17 +All configuration parameters are defined in `nodes.yaml`, with exception of IP
  18 +addresses, which are defined in different files:
  19 +
  20 +- for local development, the IP addresses of the Vagrant VMs are defined in
  21 + config/local/ips.yaml.
  22 +
  23 +- for production, you need to create a new file called
  24 + `config/production/ips.yaml`
  25 +
  26 +You will probably not need to change nodes.yaml unless you are developing the
  27 +deployment process.
  28 +
  29 +## Deploy
  30 +
  31 +### Development
  32 +
  33 +First you have to bring up the development virtual machines:
  34 +
  35 +```bash
  36 +$ vagrant up
  37 +$ rake preconfig
  38 +$ rake bootstrap_common
  39 +```
  40 +
  41 +Right now there are 5 VM's, so this might take a while. The basic commands for
  42 +deployment:
  43 +
  44 +```bash
  45 +$ rake # deploys all servers
  46 +$ rake nodes # lists all servers
  47 +$ rake converge:$server # deploys only $server
  48 +```
  49 +
  50 +### Production
  51 +
  52 +* TODO: document adding the SSL key and certificate
  53 +* TODO: document creation of `prod.yaml`.
  54 +* TODO: document SSH configuration
  55 +
  56 +The very first step is
  57 +
  58 +```
  59 +$ rake preconfig SPB_ENV=production
  60 +```
  61 +
  62 +This will perform some initial configuration to the system that is required
  63 +before doing the actual deployment.
  64 +
  65 +After that:
  66 +
  67 +```bash
  68 +$ rake SPB_ENV=production # deploys all servers
  69 +$ rake nodes SPB_ENV=production # lists all servers
  70 +$ rake converge:$server SPB_ENV=production # deploys only $server
  71 +```
  72 +
  73 +You can also do `export SPB_ENV=production` in your shell and omit it in the
  74 +`rake` calls.
  75 +
  76 +See the output of `rake -T` for other tasks.
  77 +
  78 +## Viewing the running site when developping locally
  79 +
  80 +Run:
  81 +
  82 +```bash
  83 +./server
  84 +```
  85 +
  86 +Follow the on-screen instructions an browse to
  87 +[http://softwarepublico.dev/](http://softwarepublico.dev/).
  88 +
  89 +Note: this requires that your system will resolve `\*.dev` to `localhost`.
  90 +Google DNS servers will do that automatically, otherwise you might add the following entries to `/etc/hosts`:
  91 +
  92 +```
  93 +127.0.53.53 softwarepublico.dev
  94 +127.0.53.53 listas.softwarepublico.dev
  95 +```
  96 +
... ...
README.md
1   -# Software Público - configuration management
  1 +# Software Público Brasileiro - desenvolvimento
2 2  
3   -## Requirements
  3 +## Organização
4 4  
5   -* [chake](https://rubygems.org/gems/chake)
6   -* rake
  5 +Este repositório contém tanto o código fonte desenvolvimento especificamente
  6 +para o SPB, quando o código de gestão de configuração necessário para implantar
  7 +o ambiente do SPB.
7 8  
8   -For development
  9 +O código fonte dos componentes e pacotes desenvolvidos está no diretório
  10 +`src/`. Os demais diretórios contém código de gestão de configuração,
  11 +documentação, utilitários etc.
9 12  
10   -* vagrant
11   -* shunit2
12   -* moreutils
13   -* redir
  13 +## Fazendo um release
14 14  
15   -## Configuration parameters
  15 +* Atualize o número de versão no arquivo VERSION
  16 +* Execute `make release`.
16 17  
17   -All configuration parameters are defined in `nodes.yaml`, with exception of IP
18   -addresses, which are defined in different files:
19   -
20   -- for local development, the IP addresses of the Vagrant VMs are defined in
21   - config/local/ips.yaml.
22   -
23   -- for production, you need to create a new file called
24   - `config/production/ips.yaml`
25   -
26   -You will probably not need to change nodes.yaml unless you are developing the
27   -deployment process.
28   -
29   -## Deploy
30   -
31   -### Development
32   -
33   -First you have to bring up the development virtual machines:
34   -
35   -```bash
36   -$ vagrant up
37   -$ rake preconfig
38   -$ rake bootstrap_common
39   -```
40   -
41   -Right now there are 5 VM's, so this might take a while. The basic commands for
42   -deployment:
43   -
44   -```bash
45   -$ rake # deploys all servers
46   -$ rake nodes # lists all servers
47   -$ rake converge:$server # deploys only $server
48   -```
49   -
50   -### Production
51   -
52   -* TODO: document adding the SSL key and certificate
53   -* TODO: document creation of `prod.yaml`.
54   -* TODO: document SSH configuration
55   -
56   -The very first step is
57   -
58   -```
59   -$ rake preconfig SPB_ENV=production
60   -```
61   -
62   -This will perform some initial configuration to the system that is required
63   -before doing the actual deployment.
64   -
65   -After that:
66   -
67   -```bash
68   -$ rake SPB_ENV=production # deploys all servers
69   -$ rake nodes SPB_ENV=production # lists all servers
70   -$ rake converge:$server SPB_ENV=production # deploys only $server
71   -```
72   -
73   -You can also do `export SPB_ENV=production` in your shell and omit it in the
74   -`rake` calls.
75   -
76   -See the output of `rake -T` for other tasks.
77   -
78   -## Viewing the running site when developping locally
79   -
80   -Run:
81   -
82   -```bash
83   -./server
84   -```
85   -
86   -Follow the on-screen instructions an browse to
87   -[http://softwarepublico.dev/](http://softwarepublico.dev/).
88   -
89   -Note: this requires that your system will resolve `\*.dev` to `localhost`.
90   -Google DNS servers will do that automatically, otherwise you might add the following entries to `/etc/hosts`:
91   -
92   -```
93   -127.0.53.53 softwarepublico.dev
94   -127.0.53.53 listas.softwarepublico.dev
95   -```
  18 +## Implantação
96 19  
  20 +Veja as instruções em README.chef.md.
... ...
VERSION 0 → 100644
... ... @@ -0,0 +1 @@
  1 +5.0a0
... ...
cookbooks/colab/recipes/default.rb
... ... @@ -21,6 +21,11 @@ package 'colab-spb-theme' do
21 21 notifies :restart, 'service[colab]'
22 22 end
23 23  
  24 +package 'colab-spb-theme' do
  25 + action :upgrade
  26 + notifies :restart, 'service[colab]'
  27 +end
  28 +
24 29 directory '/etc/colab' do
25 30 owner 'root'
26 31 group 'root'
... ...
src/Makefile 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +VERSION = $(shell cat ../VERSION)
  2 +subdirs = colab-spb-plugin colab-spb-theme-plugin noosfero-spb
  3 +
  4 +dist_all = $(patsubst %, %-dist, $(subdirs))
  5 +dist: $(dist_all)
  6 +$(dist_all): %-dist : %
  7 + if [ -f $*/Makefile ]; then make -C $* dist; fi
  8 + if [ -f $*/setup.py ]; then (cd $* && python setup.py sdist); fi
  9 +
  10 +clean_all = $(patsubst %, %-clean, $(subdirs))
  11 +clean: $(clean_all)
  12 + $(MAKE) -C pkg-rpm/ clean
  13 +
  14 +$(clean_all): %-clean : %
  15 + if [ -f $*/Makefile ]; then make -C $* clean; fi
  16 + if [ -f $*/setup.py ]; then rm -rf $*/dist; fi
  17 +
  18 +release:
  19 + @if git tag | grep -q '^v$(VERSION)$$'; then \
  20 + echo "E: version $(VERSION) already tagged. You need a new version number"; \
  21 + false; \
  22 + fi
  23 + echo '$(VERSION)' > colab-spb-plugin/VERSION
  24 + echo '$(VERSION)' > colab-spb-theme-plugin/VERSION
  25 + echo '$(VERSION)' > noosfero-spb/VERSION
  26 + $(MAKE) dist
  27 + cp noosfero-spb/dist/*.tar.* pkg-rpm/noosfero-spb/
  28 + cp colab-spb-theme-plugin/dist/*.tar.* pkg-rpm/colab-spb-theme/
  29 + cp colab-spb-plugin/dist/*.tar.* pkg-rpm/colab-spb-plugin/
  30 + sed -i -e 's/^\(Version:\s*\).*/\1$(VERSION)/' \
  31 + pkg-rpm/colab-spb-theme/colab-spb-theme.spec \
  32 + pkg-rpm/colab-spb-plugin/colab-spb-plugin.spec \
  33 + pkg-rpm/noosfero-spb/noosfero-spb.spec
  34 + git diff
  35 + @printf "Confirm release? [y/N]"; \
  36 + read confirm; \
  37 + if [ "$$confirm" = 'y' -o "$$confirm" = 'Y' ]; then \
  38 + echo "SPB release $(VERSION)" > .commit_template; \
  39 + git commit * --file .commit_template; \
  40 + rm -f .commit_template; \
  41 + else \
  42 + echo 'Aborting at your request!'; \
  43 + git checkout -- colab-spb-theme-plugin/VERSION noosfero-spb/VERSION colab-spb-plugin/VERSION ; \
  44 + git checkout -- pkg-rpm/colab-spb-theme/ pkg-rpm/noosfero-spb/ pkg-rpm/colab-spb-plugin/ ; \
  45 + false; \
  46 + fi
  47 + # TODO add pkg-rpm/colab-spb-plugin to the git checkout all above
  48 + $(MAKE) -C pkg-rpm/ noosfero-spb-upload colab-spb-theme-upload colab-spb-plugin-upload
  49 + git tag $(VERSION) -s -m 'SPB Release $(VERSION)'
... ...
src/colab-spb-plugin/.gitignore
... ... @@ -2,3 +2,4 @@
2 2 *.pyc
3 3 *.sw[po]
4 4 *~
  5 +dist/
... ...
src/colab-spb-plugin/MANIFEST.in
1 1 include README.rst
2 2 include MANIFEST.in
  3 +include VERSION
3 4 recursive-include src/colab_spb/static *
4 5 recursive-include src/colab_spb/locale *
5 6 recursive-include src/colab_spb/templates *
... ...
src/colab-spb-plugin/VERSION 0 → 100644
... ... @@ -0,0 +1 @@
  1 +5.0a0
... ...
src/colab-spb-plugin/setup.py
... ... @@ -11,9 +11,11 @@ install_requires = ['colab', 'colab_noosfero', 'colab_gitlab']
11 11  
12 12 tests_require = [ ]
13 13  
  14 +version = open('VERSION').read().strip()
  15 +
14 16 setup(
15   - name='colab-spb',
16   - version='0.1.0',
  17 + name='colab-spb-plugin',
  18 + version=version,
17 19 author='Macartur Sousa',
18 20 author_email='macartur.sc@gmail.com',
19 21 url='https://portal.softwarepublico.gov.br/gitlab/softwarepublico/colab-spb-plugin/',
... ...
src/colab-spb-theme-plugin/Makefile
1 1 PACKAGE = colab-spb-theme
2   -VERSION = 0.2.0
  2 +VERSION = $(shell cat VERSION)
3 3 DISTDIR = dist
4 4 PACKAGE_NAME = $(PACKAGE)-$(VERSION)
5 5 TARBALL = $(PACKAGE_NAME).tar.gz
... ... @@ -10,10 +10,10 @@ all:
10 10 colab_dir=/usr/lib/colab
11 11  
12 12 dist: clean
13   - mkdir -p $(DISTDIR)/$(PACKAGE_NAME)
14   - tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd $(DISTDIR)/$(PACKAGE_NAME) && tar xzf -)
  13 + mkdir -p $(DISTDIR)/$(PACKAGE_NAME)
  14 + tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd $(DISTDIR)/$(PACKAGE_NAME) && tar xf -)
15 15 cd $(DISTDIR) && tar -czf $(TARBALL) $(PACKAGE_NAME)
16   - rm -r $(DISTDIR)/$(PACKAGE_NAME)
  16 + rm -r $(DISTDIR)/$(PACKAGE_NAME)
17 17 clean:
18 18 $(RM) $(TARBALL)
19 19 $(RM) -r $(DISTDIR)
... ...
src/colab-spb-theme-plugin/VERSION 0 → 100644
... ... @@ -0,0 +1 @@
  1 +5.0a0
... ...
src/noosfero-spb/.gitignore
1   -*.tar.gz
2   -/noosfero-spb-*
  1 +dist/
... ...
src/noosfero-spb/Makefile
1 1 PACKAGE = noosfero-spb
2   -VERSION = 4.2.1
  2 +VERSION = $(shell cat VERSION)
3 3 DISTDIR = $(PACKAGE)-$(VERSION)
4 4 TARBALL = $(DISTDIR).tar.gz
5 5  
... ... @@ -11,13 +11,13 @@ themes_dir=/usr/lib/noosfero/public/designs/themes
11 11 noosfero_dir=/usr/lib/noosfero
12 12  
13 13 dist: clean
14   - mkdir $(DISTDIR)
15   - tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd $(DISTDIR) && tar xaf -)
16   - tar --exclude=.git -czf $(TARBALL) $(DISTDIR)
  14 + mkdir -p dist/$(DISTDIR)
  15 + tar --exclude=.git --exclude=$(DISTDIR) -cf - * | (cd dist/$(DISTDIR) && tar xaf -)
  16 + cd dist && tar --exclude=.git -czf $(TARBALL) $(DISTDIR)
  17 + $(RM) -r dist/$(DISTDIR)
17 18  
18 19 clean:
19   - $(RM) $(TARBALL)
20   - $(RM) -r $(DISTDIR)
  20 + $(RM) -r dist/
21 21  
22 22 install:
23 23 install -d -m 0755 $(DESTDIR)/$(plugins_dir)/software_communities
... ...
src/noosfero-spb/VERSION 0 → 100644
... ... @@ -0,0 +1 @@
  1 +5.0a0
... ...
src/pkg-rpm/.gitignore
1 1 /.obs
2 2 /.config.mk
  3 +*/*.tar.*
  4 +/.virtualenv
... ...
src/pkg-rpm/Makefile
1 1 OBSPROJECT = isv:spb:devel
2 2 COPR_PROJECT = softwarepublico/v5
3   -LOCAL_BUILD_DIR = $(PWD)/build
  3 +LOCAL_BUILD_DIR = $(CURDIR)/build
4 4  
5 5 # Vagrant environment does not accept links from/to shared folder
6   -ifeq "$(PWD)" "/vagrant"
  6 +ifeq "/vagrant" "$(shell ls -1d /vagrant 2>/dev/null)"
7 7 LOCAL_BUILD_DIR = /home/vagrant/rpmbuild
8 8 endif
9 9  
... ... @@ -57,7 +57,7 @@ checkout_packages_obs = $(patsubst %, %-checkout-obs, $(packages))
57 57 upload_packages_obs = $(patsubst %, %-upload-obs, $(packages))
58 58 diff_packages_obs = $(patsubst %, %-diff-obs, $(packages))
59 59  
60   -.PHONY: $(build_packages) $(checkout_packages_obs) $(upload_packages_obs) $(diff_packages_obs)
  60 +.PHONY: $(build_packages) $(checkout_packages_obs) $(upload_packages_obs) $(diff_packages_obs) copr-cli
61 61  
62 62 ### Targets
63 63  
... ... @@ -76,8 +76,14 @@ $(build_src_packages): %-build-src : %
76 76 rm -f $(LOCAL_BUILD_DIR)/SRPMS/$*-*.src.rpm
77 77 cd $* && $(BUILD_PREFIX) rpmbuild --define "_topdir $(LOCAL_BUILD_DIR)" -bs $*.spec --nodeps
78 78  
79   -$(upload_packages): %-upload : %-build-src %
80   - copr-cli build $(COPR_PROJECT) $(LOCAL_BUILD_DIR)/SRPMS/$*-*.src.rpm --nowait
  79 +$(upload_packages): %-upload : %-build-src % copr-cli
  80 + .virtualenv/bin/copr-cli build $(COPR_PROJECT) $(LOCAL_BUILD_DIR)/SRPMS/$*-*.src.rpm --nowait
  81 +
  82 +copr-cli: .virtualenv/bin/copr-cli
  83 +
  84 +.virtualenv/bin/copr-cli:
  85 + virtualenv .virtualenv
  86 + .virtualenv/bin/pip install copr-cli
81 87  
82 88 ### OBS targets (deprecated)
83 89  
... ... @@ -102,3 +108,8 @@ diff-obs: $(diff_packages_obs)
102 108  
103 109 status-obs st-obs:
104 110 @$(MAKE) diff | diffstat -C
  111 +
  112 +clean:
  113 + rm -rf */*.tar.*
  114 + rm -rf build/
  115 + rm -rf .virtualenv/
... ...
src/pkg-rpm/colab-spb-plugin/colab-spb-plugin.spec 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +Name: colab-spb-plugin
  2 +Version: 5.0a0
  3 +Release: 1
  4 +Summary: SPB-specific Colab plugin
  5 +License: GPL-3.0
  6 +Group: Applications/Publishing
  7 +Url: https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico
  8 +Source0: %{name}-%{version}.tar.gz
  9 +Requires: colab >= 1.11
  10 +BuildArch: noarch
  11 +BuildRequires: colab, colab-deps >= 1.11.4, python-virtualenv
  12 +
  13 +%description
  14 +This package contains Colab plugin for the Software Público Brasileiro platform.
  15 +
  16 +%prep
  17 +%setup -q
  18 +
  19 +%build
  20 +# install colab and colab-des into virtualenv
  21 +rm -rf virtualenv
  22 +cp -r /usr/lib/colab virtualenv
  23 +PATH=$(pwd)/virtualenv/bin:$PATH pip install --use-wheel --no-index .
  24 +virtualenv --relocatable virtualenv
  25 +
  26 +rpm -ql colab-deps colab | sed '/^\/usr\/lib\/colab\// !d; s#/usr/lib/colab/##' > cleanup.list
  27 +while read f; do
  28 + if [ -f "virtualenv/$f" ]; then
  29 + rm -f "virtualenv/$f"
  30 + fi
  31 +done < cleanup.list
  32 +rm -f cleanup.list
  33 +find virtualenv -type d -empty -delete
  34 +rm -rf virtualenv/bin
  35 +rm -rf virtualenv/include
  36 +
  37 +%install
  38 +
  39 +install -d -m 0755 %{buildroot}/usr/lib
  40 +rm -rf %{buildroot}/usr/lib/colab
  41 +cp -r virtualenv %{buildroot}/usr/lib/colab
  42 +
  43 +%files
  44 +%defattr(-,root,root)
  45 +/usr/lib/colab
... ...
src/pkg-rpm/colab-spb-theme/colab-spb-theme.spec
1 1  
2 2 Name: colab-spb-theme
3   -Version: 0.2.0
  3 +Version: 5.0a0
4 4 Release: 9.1
5 5 Summary: SPB-specific Colab theme
6 6 License: GPL-3.0
... ...