Compare commits

...

9 Commits

Author SHA1 Message Date
d3b021a1cb v0.2.0 2019-01-28 20:38:12 +01:00
b9b9b65ce6 Merge pull request #35 from balena-io/hide-db-redis
Do not publish DB and Redis ports to the host
2019-01-28 19:36:27 +00:00
9fb3f76858 Do not publish DB and Redis ports to the host
We are currently exposing the DB and Redis ports to the host, making the services externally accessible, which is very useful for a development environment.

`docker-compose` is however the only deployment method we currently support, and our Getting Started guide uses the very same configuration to guide users through the process of deploying open-balena on a public server (mostly because it’s easier with regards to DNS). This means we’re effectively guiding users to deploy open-balena in a very insecure way.

This commit removes host port bindings for the database and Redis services, effectively making them externally inaccessible.

Fixes #34

Change-type: minor
2019-01-25 15:34:58 +02:00
52fb653223 v0.1.4 2019-01-10 12:03:32 +01:00
7332b6971e Merge pull request #33 from balena-io/improve-vagrant
vagrant: Add missing Node dependency
2019-01-10 11:01:42 +00:00
011f3a35f9 vagrant: Add missing Node dependency
Signed-off-by: Rich Bayliss <rich@balena.io>
Change-type: patch
2019-01-10 10:57:53 +00:00
0842b7b4ae v0.1.3 2019-01-10 10:47:30 +01:00
37ecfb8996 Merge pull request #32 from balena-io/improve-vagrant
vagrant: Improve the Vagrant file to make development easier
2019-01-10 09:45:45 +00:00
bd638ac409 vagrant: Improve the Vagrant file to make development easier
Vagrant machine is based on Ubuntu 18.04 including:
- docker
- docker-compose

Provisions some helper functions to the CLI:
- dc (shortcut to ./scripts/compose)
- enter {service} (opens a terminal in the service's container)
- logs {service} (access the journal of the service)

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2019-01-10 09:41:11 +00:00
5 changed files with 86 additions and 15 deletions

50
.openbalenarc Normal file
View File

@ -0,0 +1,50 @@
#!/bin/bash
alias dc="/home/vagrant/openbalena/scripts/compose"
function enter () {
if [[ $# -lt 1 ]]; then
echo "Usage: enter <service name> [command]"
echo " "
echo " Runs a [command] in the service specified."
echo " "
echo " command:"
echo " (default) /bin/bash"
echo " "
echo " example:"
echo " enter api # this will run the command '/bin/bash' in the API service, providing a shell prompt"
echo " enter api uptime # this will run the command 'uptime' in the API service, and return"
return 1
fi
service="$1"
shift
COMMAND=/bin/bash
if [[ $# -gt 0 ]]; then
COMMAND="$@"
fi
dc exec ${service} /bin/bash -c "${COMMAND}"
}
function logs () {
if [[ $# -lt 1 ]]; then
echo "Usage: logs <service name> [options]"
echo " "
echo " Shows the logs from journalctl in the service specified."
echo " "
echo " options:"
echo " -f tail the log stream"
echo " -n number of lines to take"
echo " "
echo " example:"
echo " logs api -fn100 # this will tail the API log, starting with the last 100 lines"
return 1
fi
service="$1"
shift
enter ${service} journalctl "$@"
}
cd /home/vagrant/openbalena

View File

@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
# v0.2.0
## (2019-01-25)
* Do not publish DB and Redis ports to the host [Akis Kesoglou]
# v0.1.4
## (2019-01-10)
* vagrant: Add missing Node dependency [Rich Bayliss]
# v0.1.3
## (2019-01-10)
* vagrant: Improve the Vagrant file to make development easier [Rich Bayliss]
# v0.1.2
## (2018-12-20)

View File

@ -1 +1 @@
0.1.2
0.2.0

27
Vagrantfile vendored
View File

@ -7,25 +7,30 @@ Vagrant.require_version '>= 2.0.0'
end
Vagrant.configure('2') do |config|
config.vm.define 'openbalenavm'
config.vm.box = 'bento/ubuntu-16.04'
config.vm.box_url = 'https://vagrantcloud.com/bento/boxes/ubuntu-16.04/versions/201808.24.0/providers/virtualbox.box'
config.vm.define 'openbalena'
config.vm.hostname = 'openbalena-vagrant'
config.vm.box = 'bento/ubuntu-18.04'
config.vm.network "public_network",
use_dhcp_assigned_default_route: true
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder '.', '/home/vagrant/open-balena'
config.vm.network 'public_network', bridge: ENV.fetch('OPENBALENA_BRIDGE', '')
config.vm.synced_folder '.', '/home/vagrant/openbalena'
config.ssh.forward_agent = true
config.vm.provision :docker
config.vm.provision :docker_compose
# FIXME: remove node
config.vm.provision :shell, inline: 'apt-get update && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/*'
$provision = <<-SCRIPT
touch /home/vagrant/.bashrc
grep -Fxq 'source /home/vagrant/openbalena/.openbalenarc' /home/vagrant/.bashrc || echo 'source /home/vagrant/openbalena/.openbalenarc' >> /home/vagrant/.bashrc
config.vm.provision :shell, privileged: false,
inline: "cd /home/vagrant/open-balena && ./scripts/quickstart -p -d #{ENV.fetch('OPENBALENA_DOMAIN', 'openbalena.local')}"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
source "/home/vagrant/.nvm/nvm.sh" # This loads nvm
nvm install 10.15.0 && nvm use 10.15.0
SCRIPT
config.vm.provision :shell, privileged: false, inline: $provision
config.vm.provision :shell, privileged: false,
inline: "echo 'cd ~/open-balena' >> ~/.bashrc"
end

View File

@ -142,11 +142,12 @@ services:
- redis
ports:
- "80:80"
- "222:222"
- "443:443"
- "3128:3128"
- "5432:5432"
- "6379:6379"
expose:
- "222"
- "5432"
- "6379"
networks:
default:
aliases: