more env/target stuff

pull/242/head
connor rigby 2017-02-02 09:00:44 -08:00
parent 21bcba77f3
commit 6bceefb3d2
25 changed files with 156 additions and 13 deletions

View File

@ -1,6 +1,7 @@
use Mix.Config
target = Mix.Project.config[:target]
env = Mix.env()
mqtt_transport = Farmbot.Transport.GenMqtt
farmware_transport = Farmbot.Transport.Farmware
@ -22,11 +23,11 @@ config :farmbot_auth, callbacks: [mqtt_transport]
config :farmbot, transports: [mqtt_transport, farmware_transport]
config :nerves, :firmware,
rootfs_additions: "config/hardware/#{Mix.Project.config[:target]}/rootfs-additions"
rootfs_additions: "config/hardware/#{target}/rootfs-additions-#{env}"
# Import configuration specific to out environment.
import_config "#{Mix.env}.exs"
import_config "#{env}.exs"
# import config specific to our nerves_target
IO.puts "using #{target} configuration."
IO.puts "using #{target} - #{env} configuration."
import_config "hardware/#{target}/hardware.exs"

View File

@ -1,3 +1,4 @@
use Mix.Config
# default port for the router to run on is 4000.
config :farmbot_configurator, port: 4000
config :farmbot_configurator,
port: 4000,
streamer_port: 4040

View File

@ -2,3 +2,7 @@ use Mix.Config
config :farmbot_system,
path: "/state",
config_file_name: "default_config_rpi.json"
config :farmbot_configurator,
port: 80,
streamer_port: 4040

View File

@ -2,3 +2,7 @@ use Mix.Config
config :farmbot_system,
path: "/state",
config_file_name: "default_config_rpi2.json"
config :farmbot_configurator,
port: 80,
streamer_port: 4040

View File

@ -0,0 +1,40 @@
# Additional configuration for erlinit
# Turn on the debug prints
#-v
# Specify the UART port that the shell should use.
-c ttyAMA0
# If more than one tty are available, always warn if the user is looking at
# the wrong one.
--warn-unused-tty
# Use dtach to capture the iex session so that it can be redirected
# to the app's GUI
#-s "/usr/bin/dtach -N /tmp/iex_prompt"
# Specify the user and group IDs for the Erlang VM
#--uid 100
#--gid 200
# Uncomment to hang the board rather than rebooting when Erlang exits
--hang-on-exit
# Run a program if the Erlang VM exits
--run-on-exit "/bin/sh"
# Run a program before the Erlang VM starts
# --pre-run-exec "/bin/sh -e /usr/bin/pre_erl.sh"
-m /dev/mmcblk0p3:/state:ext4::
# Enable UTF-8 filename handling in Erlang and custom inet configuration
-e LANG=en_US.UTF-8;LANGUAGE=en;ERL_INETRC=/etc/erl_inetrc
# Erlang release search path
-r /srv/erlang
# Assign a unique hostname based on the board id
-d "/usr/bin/boardid -b rpi -n 4"
-n nerves-%.4s

View File

@ -0,0 +1,40 @@
# Additional configuration for erlinit
# Turn on the debug prints
#-v
# Specify the UART port that the shell should use.
-c ttyAMA0
# If more than one tty are available, always warn if the user is looking at
# the wrong one.
--warn-unused-tty
# Use dtach to capture the iex session so that it can be redirected
# to the app's GUI
#-s "/usr/bin/dtach -N /tmp/iex_prompt"
# Specify the user and group IDs for the Erlang VM
#--uid 100
#--gid 200
# Uncomment to hang the board rather than rebooting when Erlang exits
--hang-on-exit
# Run a program if the Erlang VM exits
--run-on-exit "/bin/sh"
# Run a program before the Erlang VM starts
# --pre-run-exec "/bin/sh -e /usr/bin/pre_erl.sh"
-m /dev/mmcblk0p3:/state:ext4::
# Enable UTF-8 filename handling in Erlang and custom inet configuration
-e LANG=en_US.UTF-8;LANGUAGE=en;ERL_INETRC=/etc/erl_inetrc
# Erlang release search path
-r /srv/erlang
# Assign a unique hostname based on the board id
-d "/usr/bin/boardid -b rpi -n 4"
-n nerves-%.4s

View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -2,4 +2,7 @@ use Mix.Config
config :farmbot_system,
path: "/state",
config_file_name: "default_config_rpi3.json"
config :farmbot_configurator,
port: 80,
streamer_port: 4040

View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -0,0 +1 @@
plant-detection

View File

@ -0,0 +1,43 @@
# Additional configuration for erlinit
# Turn on the debug prints
#-v
# Specify the UART port that the shell should use.
# GPIO UART PORT
#-c ttyS0
# HDMI
-c tty1
# If more than one tty are available, always warn if the user is looking at
# the wrong one.
--warn-unused-tty
# Use dtach to capture the iex session so that it can be redirected
# to the app's GUI
#-s "/usr/bin/dtach -N /tmp/iex_prompt"
# Specify the user and group IDs for the Erlang VM
#--uid 100
#--gid 200
# Uncomment to hang the board rather than rebooting when Erlang exits
# --hang-on-exit
# Run a program if the Erlang VM exits
--run-on-exit "/bin/sh"
# Run a program before the Erlang VM starts
# --pre-run-exec "/bin/sh -e /usr/bin/pre_erl.sh"
-m /dev/mmcblk0p3:/state:ext4::
# Enable UTF-8 filename handling in Erlang and custom inet configuration
-e LANG=en_US.UTF-8;LANGUAGE=en;ERL_INETRC=/etc/erl_inetrc
# Erlang release search path
-r /srv/erlang
# Assign a unique hostname based on the board id
-d "/usr/bin/boardid -b rpi -n 4"
-n nerves-%.4s

View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -1,5 +1,7 @@
use Mix.Config
config :farmbot_configurator, port: 80
config :farmbot_configurator,
port: 80,
streamer_port: 4040
config :tzdata, :data_dir, "/tmp"
config :tzdata, :autoupdate, :disabled
config :nerves_interim_wifi, regulatory_domain: "US" #FIXME

View File

@ -100,6 +100,7 @@ defmodule Farmbot.Mixfile do
"credo": ["credo list --only readability,warning,todo,inspect,refactor --ignore-checks todo,spec"],
"test": ["test", "credo"]]
# TODO(Connor) Maybe warn if building firmware in dev mode?
defp aliases(_system) do
["deps.precompile": ["nerves.precompile", "deps.precompile"],
"deps.loadpaths": ["deps.loadpaths", "nerves.loadpaths"],

View File

@ -1,7 +1,6 @@
defmodule Farmbot.Auth.Mixfile do
use Mix.Project
@version Path.join([__DIR__, "..", "farmbot", "VERSION"]) |> File.read! |> String.strip
@target System.get_env("MIX_TARGET") || "host"
def project do
[app: :farmbot_auth,

View File

@ -4,8 +4,6 @@ defmodule Farmbot.System.NervesCommon.Mixfile do
|> File.read!
|> String.strip
@target System.get_env("MIX_TARGET") || "host"
def project do
[app: :farmbot_system_nerves_common,
version: @version,

View File

@ -1,8 +1,8 @@
#!/bin/bash
SYSTEM=$1
export MIX_ENV=prod
export NERVES_TARGET=$SYSTEM
echo "building system on $SYSTEM"
export MIX_TARGET=$SYSTEM
echo "building firmware for $SYSTEM"
cd apps/farmbot
mix deps.get
mix firmware

View File

@ -3,7 +3,7 @@
SYSTEM=$1
VERSION=$2
export MIX_ENV=prod
export NERVES_TARGET=$SYSTEM
export MIX_TARGET=$SYSTEM
REL_DIR=release-$VERSION
mkdir -p $REL_DIR