Skip to content

Commit 997f131

Browse files
authored
fix(vagrant): remove ansible and use bash. (#2003)
Use bash scripts to setup everything.
1 parent a770c0b commit 997f131

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

Vagrantfile

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,15 @@
55

66
VAGRANTFILE_API_VERSION = "2"
77

8-
# Ansible install script for Ubuntu
9-
$ansible_install_script = <<SCRIPT
10-
export DEBIAN_FRONTEND=noninteractive
11-
echo Check if Ansible existing...
12-
if ! which ansible >/dev/null; then
13-
echo update package index files...
14-
apt-get update -qq
15-
echo install Ansible...
16-
apt-get install -qq ansible
17-
fi
18-
SCRIPT
19-
20-
$ansible_local_provisioning_script = <<SCRIPT
21-
export DEBIAN_FRONTEND=noninteractive
22-
export PYTHONUNBUFFERED=1
23-
echo PYBOSSA provisioning with Ansible...
24-
ansible-playbook -u vagrant /vagrant/provisioning/playbook.yml -i /vagrant/provisioning/ansible_hosts -c local
25-
SCRIPT
26-
278
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
28-
config.vm.box = "bento/ubuntu-18.04"
9+
config.vm.box = "bento/ubuntu-20.04"
2910
config.vm.provider "virtualbox" do |v|
3011
v.memory = 1024
3112
end
3213
config.vm.network :forwarded_port, host: 5000, guest: 5000
3314
config.vm.network :forwarded_port, host: 5001, guest: 5001
3415
# turn off warning message `stdin: is not a tty error`
3516
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
36-
# be sure that there is Ansible for local provisioning
37-
config.vm.provision "shell", inline: $ansible_install_script
38-
# do the final Ansible local provisioning
39-
config.vm.provision "shell", inline: $ansible_local_provisioning_script
17+
config.vm.provision "shell", path: "contrib/server.sh"
18+
config.vm.provision "shell", path: "contrib/pybossa.sh", privileged: false
4019
end

contrib/pybossa.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[ ! -d "/home/vagrant/.pyenv" ] && curl https://pyenv.run | bash
2+
3+
export PATH="/home/vagrant/.pyenv/bin:$PATH"
4+
eval "$(pyenv init -)"
5+
eval "$(pyenv virtualenv-init -)"
6+
7+
tee -a ~/home/vagrant/.bashrc << END
8+
9+
export PATH="/home/vagrant/.pyenv/bin:$PATH"
10+
eval "$(pyenv init -)"
11+
eval "$(pyenv virtualenv-init -)"
12+
13+
END
14+
15+
pyenv install 3.6.12
16+
pyenv global 3.6.12
17+
echo setting up PYBOSSA...
18+
git clone --recursive https://github.com/Scifabric/pybossa
19+
cd pybossa
20+
python -mvenv env
21+
source env/bin/activate
22+
pip install -U pip
23+
pip install -r requirements.txt
24+
cp settings_local.py.tmpl settings_local.py
25+
cp alembic.ini.template alembic.ini
26+
redis-server contrib/sentinel.conf --sentinel
27+
python cli.py db_create
28+
python run.py

contrib/server.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
echo update package index files...
2+
apt-get update -qq
3+
4+
echo installing required external libraries...
5+
apt-get -y install git postgresql postgresql-server-dev-all libpq-dev python3-psycopg2 libsasl2-dev libldap2-dev libssl-dev python3-venv python-dev build-essential libjpeg-dev libssl-dev libffi-dev dbus libdbus-1-dev libdbus-glib-1-dev libldap2-dev libsasl2-dev redis-server python3-dev
6+
7+
sudo su postgres -c "psql -c \"CREATE ROLE pybossa SUPERUSER LOGIN PASSWORD 'tester'\" "
8+
sudo su postgres -c "createdb pybossa -O pybossa"

0 commit comments

Comments
 (0)