# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "ubuntu/bionic64" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. config.vm.box_check_update = true # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port # config.vm.network "forwarded_port", guest: 80, host: 8080 # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine and only allow access # via 127.0.0.1 to disable public access # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" # Create a private network, which allows host-only access to the machine # using a specific IP. # config.vm.network "private_network", ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network "public_network" # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. #config.vm.synced_folder "...C:/Documents", "/vagrant/home/projects/nd" config.vm.hostname = "ryans-vm" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: vb.memory = "2048" vb.name = "cate" config.vm.define "my_box" end # # View the documentation for the provider you are using for more # information on available options. # Enable provisioning with a shell script. Additional provisioners such as # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. config.vm.provision "shell", inline: <<-SHELL #!/bin/bash ####INSTALL UBUNTU ENVIRONMENT LIBRARIES###### add-apt-repository ppa:deadsnakes/ppa add-apt-repository ppa:ubuntugis/ppa PYTHON_VERSION=3.6 apt update && apt upgrade apt install -y \ gdal-bin \ python3 \ python${PYTHON_VERSION} \ python${PYTHON_VERSION}-dev \ python3-dev \ python3-pip \ python3-gdal \ python3-setuptools \ libgdal-dev \ libgsl-dev \ libssl-dev \ virtualenv \ libsm6 \ libgl1-mesa-glx \ libxext6 \ libsm6 \ libxrender1 \ libfontconfig1 \ tree ####CREATE PROJECT STRCTURE##### #when adding vagrant to .bashrc, ~ changed from /home/vagrant to /root HOME=/home/vagrant PROJECTS=$HOME/projects ENVS="/envs" NAME="venv" #DATA=$HOME/projects mkdir -p $ENVS mkdir -p $PROJECTS mkdir -p $DATA echo "New project folder created at:" echo $PROJECTS ####CREATE PYTHON ENVIRONMENT######## echo "making virtual environment" virtualenv -p python${PYTHON_VERSION} $ENVS/$NAME ###ACTIVATE ENVIRONMENT AND INSTALL PYTHON LIBRARIES######## source $ENVS/$NAME/bin/activate pip${PYTHON_VERSION} install \ gdal ">=2.2.3,<3.0" --global-option="build_ext" \ --global-option="--gdal-config=/usr/bin/gdal-config" \ --global-option="--include-dirs=/usr/include/gdal/" # for pyproj on 3.7 (issue 136) #https://github.com/jswhit/pyproj/zipball/master#egg=pyproj \ #do seperate pip installs so that if one fails the the rest are still installed pip${PYTHON_VERSION} install "attrs >=18.2.0" pip${PYTHON_VERSION} install "boto3 >=1.9.2,<2.0" pip${PYTHON_VERSION} install "botocore >=1.12.3,<2.0" pip${PYTHON_VERSION} install "cartopy >=0.15,<1.0" pip${PYTHON_VERSION} install "cython >=0.25,<1.0" pip${PYTHON_VERSION} install "dask >=0.19,<1.0.3" pip${PYTHON_VERSION} install "fiona >=1.7,<2.0" pip${PYTHON_VERSION} install "geopandas >=0.3,<1.0" pip${PYTHON_VERSION} install "geos >=3.5.1,<4.0" pip${PYTHON_VERSION} install "hdf4 >=4.2.12,<5.0" pip${PYTHON_VERSION} install "h5netcdf >=0.4.2,<1.0" pip${PYTHON_VERSION} install "jdcal >=1.3,<2.0" pip${PYTHON_VERSION} install "matplotlib >=2.2,<3.0" pip${PYTHON_VERSION} install "munch ==2.3.1" pip${PYTHON_VERSION} install "netcdf4 >=1.2,<2.0" pip${PYTHON_VERSION} install "numba >=0.33,<1.0" pip${PYTHON_VERSION} install "numpy >=1.13,<2.0" pip${PYTHON_VERSION} install "owslib >=0.14,<1.0" pip${PYTHON_VERSION} install "pandas >=0.22,<1.0" pip${PYTHON_VERSION} install "pillow >=5.0,<6.0" pip${PYTHON_VERSION} install "psutil >=5.2,<6.0" pip${PYTHON_VERSION} install "pyproj >=1.9,<2.0" pip${PYTHON_VERSION} install "pyqt >=5.6,<6.0" pip${PYTHON_VERSION} install "pyshp >=1.2,<2.0" pip${PYTHON_VERSION} install "python-dateutil >=2.6,<3.0" pip${PYTHON_VERSION} install "scipy >=0.19,<1.0" pip${PYTHON_VERSION} install "shapely >=1.6,<2.0" pip${PYTHON_VERSION} install "tornado >=5.0,<6.0" pip${PYTHON_VERSION} install "xarray >=0.10.6" #pip${PYTHON_VERSION} install ##pip${PYTHON_VERSION} install ############################### #### PROJECT SPECIFIC CODE #### ############################### cd $PROJECTS rm -rf nd || true #remove project if true git clone https://github.com/CCI-Tools/cate.git cd cate $ENVS/$NAME/bin/pip${PYTHON_VERSION} install . ###FIX PERMISSIONS FOR VAGRANT######## #Give vagrant user access to home for deployment permission from pycharm echo "Giving vagrant sudo root access to /home/vagrant" #echo "sudo su -" >> .bashrc chown vagrant:vagrant $HOME -R SHELL end