Skip to content

Commit c8f5cb1

Browse files
committed
WIP FreeBSD test env
Test set up for FreeBSD to test an Elixir app.
1 parent 82ddb6b commit c8f5cb1

6 files changed

Lines changed: 95 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ node_modules
1111
tags
1212
**/commands/processmon
1313
support/processmon/processmon
14+
.vagrant

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,3 +641,17 @@ To bundle the latest version:
641641
```
642642
rake global:install_processmon
643643
```
644+
645+
## FreeBSD setup
646+
647+
There's a Vagrantfile with a FreeBSD VM included.
648+
It requires a couple of steps to get running:
649+
650+
```
651+
vagrant up freebsd
652+
vagrant ssh freebsd
653+
cd /app
654+
./run_in_vm.sh
655+
```
656+
657+
Then, visit http://localhost:4001

Vagrantfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
Vagrant.configure("2") do |config|
3+
config.vm.define "freebsd" do |freebsd|
4+
freebsd.vm.box = "bento/freebsd-14"
5+
freebsd.vm.guest = :freebsd
6+
freebsd.vm.network "private_network", type: "dhcp"
7+
freebsd.vm.synced_folder "./elixir/phoenix/app", "/app", type: "rsync",
8+
rsync__exclude: [".git/", "node_modules/", "_build/", "deps/"]
9+
freebsd.vm.synced_folder "./elixir/integration", "/integration", type: "rsync",
10+
rsync__exclude: [".git/", "_build/", "deps/"]
11+
12+
freebsd.vm.provider "virtualbox" do |vb|
13+
vb.check_guest_additions = false
14+
end
15+
16+
freebsd.vm.provider "utm" do |u|
17+
u.name = "freebsd"
18+
u.cpus = 2
19+
u.memory = 2048
20+
u.icon = "freebsd"
21+
#u.directory_share_mode = "webDAV"
22+
u.check_guest_additions = false
23+
end
24+
freebsd.ssh.shell = "sh"
25+
26+
freebsd.vm.hostname = "freebsd"
27+
freebsd.vm.network "private_network", ip: "192.168.56.12"
28+
freebsd.vm.network "forwarded_port", guest: 4001, host: 4001
29+
freebsd.vm.provision "shell", inline: <<-SHELL
30+
echo test >> ~/testado
31+
sed -e 's/\#DEFAULT_ALWAYS_YES = false/DEFAULT_ALWAYS_YES = true/g' -e 's/\#ASSUME_ALWAYS_YES = false/ASSUME_ALWAYS_YES = true/g' /usr/local/etc/pkg.conf > /tmp/pkg.conf
32+
mv -f /tmp/pkg.conf /usr/local/etc/pkg.conf
33+
pkg install gcc gmake openssl automake libtool wget python3 gmake lftp vim ruby-build elixir postgresql16-server postgresql16-client git
34+
echo 'eval "$(rbenv init -)"' > ~/.bashrc
35+
36+
# Set up PostgreSQL
37+
sysrc postgresql_enable="YES"
38+
service postgresql initdb
39+
service postgresql start
40+
41+
# Create database user and database
42+
su -m postgres -c "createuser -s vagrant" || true
43+
su -m vagrant -c "createdb phoenix_dev" || true
44+
SHELL
45+
end
46+
end

elixir/phoenix/app/appsignal.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
APPSIGNAL_WORKING_DIRECTORY_PATH=/tmp/working_directory
2+
APPSIGNAL_LOG_PATH=/tmp
3+
APPSIGNAL_HOSTNAME=test-setup-container
4+
APPSIGNAL_LOG_LEVEL=trace
5+
APPSIGNAL_IGNORE_NAMESPACES=user

elixir/phoenix/app/config/dev.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ config :example, ExampleWeb.Endpoint,
2828
secret_key_base: "WwOZdtFSngz7DrtXHkco0fXMI0Nz73db7QJWaTEBaILtqszOeUJpYeORa2J1IAaV",
2929
watchers: [
3030
esbuild:
31-
{Esbuild, :install_and_run, [:example, ~w(--sourcemap=inline --watch)]},
32-
tailwind: {Tailwind, :install_and_run, [:example, ~w(--watch)]}
31+
{Esbuild, :install_and_run, [:example, ~w(--sourcemap=inline --watch)]}
3332
]
3433

3534
# ## SSL Support

elixir/phoenix/app/run_in_vm.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
export DATABASE_URL="ecto://postgres@localhost/phoenix_dev"
6+
export PORT=4001
7+
export APPSIGNAL_APP_NAME=elixir-phoenix
8+
export APPSIGNAL_LOG_LEVEL=trace
9+
10+
# Load environment variables from env files
11+
if [ -f /app/appsignal.env ]; then
12+
set -a
13+
. /app/appsignal.env
14+
set +a
15+
fi
16+
17+
if [ -f /app/appsignal_key.env ]; then
18+
set -a
19+
. /app/appsignal_key.env
20+
set +a
21+
fi
22+
23+
cd /app
24+
mix local.hex --force
25+
mix local.rebar --force
26+
mix deps.get
27+
mix ecto.migrate
28+
mix phx.server

0 commit comments

Comments
 (0)