Last active
March 27, 2021 12:53
-
-
Save dtsmith2001/3b08017575afef29ec4e7437f97891ad to your computer and use it in GitHub Desktop.
Install MongoDB and code-server for CubeJS Dashboard Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MIT License | |
# | |
# Copyright (c) 2021 Vallum Software, LLC | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
# | |
# Vagrantfile for a VM to experiment with | |
# | |
# https://real-time-dashboard.cube.dev/cube-js-api-with-mongo-db | |
# | |
# I tried to incorporate https://github.com/cdr/code-server so I could edit | |
# from a browser outside the VM but it didn't work as I expected. I don't | |
# have time to troubleshoot at this point. | |
# | |
# Cloud9 https://cloud9-sdk.readme.io/ is a possible alternatvie to code-server | |
# | |
# mongosqld via systemd doesn't quite act as I expected. I usually start it manually. | |
# | |
# Note: | |
# generic/ubuntu2004 for libvirt | |
# ubuntu/focal64 for virtualbox | |
# | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/focal64" | |
# config.vm.box = "generic/ubuntu2004" | |
config.vm.network "private_network", ip: "192.168.66.2" | |
config.vm.network "forwarded_port", guest: 4000, host: 4000 | |
config.vm.network "forwarded_port", guest: 3000, host: 3000 | |
config.vm.provider "virtualbox" do |v| | |
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
v.memory = 2048 | |
v.cpus = 2 | |
end | |
$update_apt=<<-SCRIPT | |
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - | |
echo "deb [arch=amd64] https://deb.nodesource.com/node_14.x focal main" | tee /etc/apt/sources.list.d/nodesource.list | |
apt update | |
# apt -y install python3-minimal python3-venv g++ build-essential zip git mongodb curl nodejs | |
SCRIPT | |
config.vm.provision "shell", inline: $update_apt | |
$sw_install=<<-SCRIPT | |
# mongosqld | |
curl -sSL https://info-mongodb-com.s3.amazonaws.com/mongodb-bi/v2/mongodb-bi-linux-x86_64-ubuntu1804-v2.14.2.tgz | tar xz | |
cd mongodb-bi-linux-x86_64-ubuntu1804-v2.14.2 | |
install -m755 bin/mongo* /usr/local/bin | |
popd | |
rm -fr mongodb-bi-linux-x86_64-ubuntu1804-v2.14.2 | |
echo "Install mongosqld" | |
mongosqld install --logAppend --logRotate=rename --logPath=/var/log/mongosqld.log | |
# configure and load all services | |
systemctl daemon-reload | |
systemctl enable --now mongosql | |
SCRIPT | |
config.vm.provision "shell", inline: $sw_install | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment