Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debian bullseye support #89

Merged
merged 4 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format documentation
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,15 @@ To browse your SDI, just drop a line in your ```/etc/hosts``` file, registering
192.168.0.19 georchestra.example.org
```
... and open https://georchestra.example.org/geonetwork/ in your browser.

# Serverspec

a serverspec testsuite is provided to test the vagrant environments Once the box is up (see previous section),
you can test the setup with the following command:

```
$ rake spec
```

This will require the `ruby-serverspec` package to be installed on the host.

27 changes: 27 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'rake'
require 'rspec/core/rake_task'

task :spec => 'spec:all'
task :default => :spec

namespace :spec do
targets = []
Dir.glob('./spec/*').each do |dir|
next unless File.directory?(dir)
target = File.basename(dir)
target = "_#{target}" if target == "default"
targets << target
end

task :all => targets
task :default => :all

targets.each do |target|
original_target = target == "_default" ? target[1..-1] : target
desc "Run serverspec tests to #{original_target}"
RSpec::Core::RakeTask.new(target.to_sym) do |t|
ENV['TARGET_HOST'] = original_target
t.pattern = "spec/#{original_target}/*_spec.rb"
end
end
end
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# please see the online documentation at vagrantup.com.

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "debian/buster64"
config.vm.box = "debian/bullseye64"

# set CPU and RAM
config.vm.provider "virtualbox" do |vb|
Expand Down
2 changes: 1 addition & 1 deletion requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ansible roles from galaxy
- elastic.elasticsearch,7.13.4
- elastic.elasticsearch,v7.13.4
- geerlingguy.kibana,4.0.1
9 changes: 8 additions & 1 deletion roles/georchestra/tasks/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
- "{{ extractor_datadir }}"
- "{{ georchestra.datadir.path }}"

- name: remove non-free and contrib for dependencies
- name: remove non-free and contrib for dependencies (buster)
apt_repository:
repo: "deb http://ftp.fr.debian.org/debian/ buster main non-free contrib"
state: absent
when: ansible_distribution_release == "buster"

- name: remove non-free and contrib for dependencies (bullseye)
apt_repository:
repo: "deb http://ftp.fr.debian.org/debian/ bullseye main non-free contrib"
state: absent
when: ansible_distribution_release == "bullseye"
21 changes: 19 additions & 2 deletions roles/georchestra/tasks/nativelibs.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
- name: enable non-free and contrib for dependencies
- name: enable non-free and contrib for dependencies (buster)
apt_repository:
repo: "deb http://deb.debian.org/debian buster main contrib"
when: ansible_distribution_release == "buster"

- name: install runtime dependencies
- name: enable non-free and contrib for dependencies (bullseye)
apt_repository:
repo: "deb http://deb.debian.org/debian bullseye main contrib"
when: ansible_distribution_release == "bullseye"

- name: install runtime dependencies (buster)
apt:
pkg: [ ttf-mscorefonts-installer, gdal-bin, libgdal-java ]
state: present
when: ansible_distribution_release == "buster"

# libgdal-java does not exist anymore in bullseye
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947960
- name: install runtime dependencies (bullseye)
apt:
pkg: [ ttf-mscorefonts-installer, gdal-bin ]
state: present
when: ansible_distribution_release == "bullseye"

#- name: fetch libjpeg-turbo deb from sourceforge
# get_url: dest=/tmp/ url=http://sourceforge.net/projects/libjpeg-turbo/files/1.4.0/libjpeg-turbo-official_1.4.0_amd64.deb
Expand All @@ -29,12 +44,14 @@
src: /usr/share/java/gdal.jar
dest: "{{ tomcat_basedir }}/georchestra/shared/gdal.jar"
state: link
when: ansible_distribution_release == "buster"

- name: hardlink gdal.jar to geoserver libdir
file:
src: /usr/share/java/gdal.jar
dest: "{{ tomcat_basedir }}/geoserver/webapps/geoserver/WEB-INF/lib/gdal.jar"
state: hard
when: ansible_distribution_release == "buster"

#- name: remove conflicting imageio-ext-gdal-bindings jar
# file: path={{ tomcat_basedir }}/geoserver/webapps/geoserver/WEB-INF/lib/imageio-ext-gdal-bindings-1.9.2.jar state=absent
1 change: 0 additions & 1 deletion roles/georchestra/tasks/wars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
- name: install debian packages
apt:
pkg: "{{ item.value.pkg }}"
default_release: buster
update_cache: yes
state: latest
with_dict: "{{ georchestra_wars }}"
Expand Down
22 changes: 20 additions & 2 deletions roles/postgresql/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,36 @@
name: sudo
state: present

- name: installing dependencies
- name: installing dependencies (buster)
apt:
pkg: ['postgis', 'postgresql-11-postgis-2.5', 'postgresql-11-postgis-2.5-scripts', 'postgresql-contrib']
state: present
update_cache: yes
when: ansible_distribution_release == "buster"
# postgresql-11-postgis-2.5-scripts #for postgis.control
# postgresql-contrib #for dblink extension

- name: install python-psycopg2 for ansible psql modules
- name: installing dependencies (bullseye)
apt:
pkg: ['postgis', 'postgresql-13-postgis-3', 'postgresql-13-postgis-3-scripts', 'postgresql-contrib']
state: present
update_cache: yes
when: ansible_distribution_release == "bullseye"
# postgresql-11-postgis-2.5-scripts #for postgis.control
# postgresql-contrib #for dblink extension


- name: install python-psycopg2 for ansible psql modules (buster)
apt:
name: python-psycopg2
state: present
when: ansible_distribution_release == "buster"

- name: install python-psycopg2 for ansible psql modules (bullseye)
apt:
name: python3-psycopg2
state: present
when: ansible_distribution_release == "bullseye"

- name: create georchestra user
become: yes
Expand Down
28 changes: 25 additions & 3 deletions roles/tomcat/tasks/common.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
- name: ensure GPG is installed
apt:
name: gpg
state: present

- name: add adoptopenjdk repository key
tags: java8
apt_key:
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public

- name: add adoptopenjdk debian repo
- name: add adoptopenjdk debian repo (buster)
tags: java8
apt_repository:
repo: "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main"
when: ansible_distribution_release == "buster"

- name: add adoptopenjdk debian repo (bullseye)
tags: java8
apt_repository:
repo: "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ bullseye main"
when: ansible_distribution_release == "bullseye"

- name: install java8 from adoptopenjdk
- name: install java8 from adoptopenjdk (buster)
tags: java8
apt:
pkg: adoptopenjdk-8-hotspot
pkg: [ adoptopenjdk-8-hotspot, adoptopenjdk-11-hotspot ]
default_release: buster
update_cache: yes
state: latest
when: ansible_distribution_release == "buster"

- name: install java8 from adoptopenjdk (bullseye)
tags: java8
apt:
pkg: [ adoptopenjdk-8-hotspot, adoptopenjdk-11-hotspot ]
default_release: bullseye
update_cache: yes
state: latest
when: ansible_distribution_release == "bullseye"

- name: default to adoptopenjdk
tags: java8
Expand Down
81 changes: 81 additions & 0 deletions spec/georchestra/georchestra_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
require 'spec_helper'

describe package('apache2') do
it { should be_installed }
end

# Frontend webserver (apache2)
describe port(80) do
it { should be_listening }
end

describe port(443) do
it { should be_listening }
end

# postgresql
describe port(5432) do
it { should be_listening }
end

# OpenLDAP / slapd
describe port(389) do
it { should be_listening }
end

# Elasticsearch
describe port(9200) do
it { should be_listening }
end

# Kibana
describe port(5601) do
it { should be_listening }
end

# tomcat-georchestra
describe port(8280) do
it { should be_listening }
end

# tomcat-geoserver
describe port(8380) do
it { should be_listening }
end

# tomcat-proxycas
describe port(8180) do
it { should be_listening }
end

describe port(8443) do
it { should be_listening }
end

# datafeeder
describe port(8480) do
it { should be_listening }
end

# geOrchestra base debian packages should be present
[ 'georchestra-analytics',
'georchestra-cas',
'georchestra-console',
'georchestra-datafeeder',
'georchestra-datafeeder-ui',
'georchestra-extractorapp',
'georchestra-geoserver',
'georchestra-geowebcache',
'georchestra-header',
'georchestra-mapfishapp',
'georchestra-security-proxy',
].each do |pkg|
describe package(pkg) do
it { should be_installed }
end
end

# geOrchestra datadir has been set up
describe file('/etc/georchestra') do
it { should be_directory }
end
41 changes: 41 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'serverspec'
require 'net/ssh'
require 'tempfile'

set :backend, :ssh

if ENV['ASK_SUDO_PASSWORD']
begin
require 'highline/import'
rescue LoadError
fail "highline is not available. Try installing it."
end
set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
else
set :sudo_password, ENV['SUDO_PASSWORD']
end

host = ENV['TARGET_HOST']

`vagrant up #{host}`

config = Tempfile.new('', Dir.tmpdir)
config.write(`vagrant ssh-config #{host}`)
config.close

options = Net::SSH::Config.for(host, [config.path])

options[:user] ||= Etc.getlogin

set :host, options[:host_name] || host
set :ssh_options, options

# Disable sudo
set :disable_sudo, true


# Set environment variables
# set :env, :LANG => 'C', :LC_MESSAGES => 'C'

# Set PATH
# set :path, '/sbin:/usr/local/sbin:$PATH'