Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ node_modules
tags
**/commands/processmon
support/processmon/processmon
.vagrant
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,3 +641,40 @@ To bundle the latest version:
```
rake global:install_processmon
```

## FreeBSD setup

There's a Vagrantfile with a FreeBSD VM included.
It requires a couple of steps to get running:

```
brew install --cask utm
vagrant plugin install vagrant_utm
vagrant destroy freebsd
vagrant up freebsd --provider=utm
```

Then in UTM, log in with `vagrant`, password `vagrant`, and run these commands.

```
cd /app
./run_in_vm.sh
```

Then, visit http://localhost:4001

### Syncing volumes

The FreeBSD VM uses rsync for syncing volumes. After making changes to files on your host machine, sync them to the VM:

```
vagrant rsync freebsd
```

To automatically sync changes as you make them:

```
vagrant rsync-auto freebsd
```

This will watch for file changes and sync them automatically to the VM.
46 changes: 46 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

Vagrant.configure("2") do |config|
config.vm.define "freebsd" do |freebsd|
freebsd.vm.box = "bento/freebsd-14"
freebsd.vm.box_architecture = "amd64"
freebsd.vm.guest = :freebsd
freebsd.vm.network "private_network", type: "dhcp"
freebsd.vm.synced_folder "./elixir/phoenix/app", "/app", type: "rsync",
rsync__exclude: [".git/", "node_modules/", "_build/", "deps/"]
freebsd.vm.synced_folder "./elixir/integration", "/integration", type: "rsync",
rsync__exclude: [".git/", "_build/", "deps/"]

freebsd.vm.provider "virtualbox" do |vb|
vb.check_guest_additions = false
end

freebsd.vm.provider "utm" do |u|
u.name = "freebsd"
u.cpus = 2
u.memory = 2048
u.icon = "freebsd"
u.check_guest_additions = false
end
freebsd.ssh.shell = "sh"

freebsd.vm.hostname = "freebsd"
freebsd.vm.network "private_network", ip: "192.168.56.12"
freebsd.vm.network "forwarded_port", guest: 4001, host: 4001
freebsd.vm.provision "shell", inline: <<-SHELL
echo test >> ~/testado
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
mv -f /tmp/pkg.conf /usr/local/etc/pkg.conf
pkg install gcc gmake openssl automake libtool wget python3 gmake lftp vim ruby-build elixir postgresql16-server postgresql16-client git
echo 'eval "$(rbenv init -)"' > ~/.bashrc

# Set up PostgreSQL
sysrc postgresql_enable="YES"
service postgresql initdb
service postgresql start

# Create database user and database
su -m postgres -c "createuser -s vagrant" || true
su -m vagrant -c "createdb phoenix_dev" || true
SHELL
end
end
5 changes: 5 additions & 0 deletions elixir/phoenix/app/appsignal.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
APPSIGNAL_WORKING_DIRECTORY_PATH=/tmp/working_directory
APPSIGNAL_LOG_PATH=/tmp
APPSIGNAL_HOSTNAME=test-setup-container
APPSIGNAL_LOG_LEVEL=trace
APPSIGNAL_IGNORE_NAMESPACES=user
3 changes: 1 addition & 2 deletions elixir/phoenix/app/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ config :example, ExampleWeb.Endpoint,
secret_key_base: "WwOZdtFSngz7DrtXHkco0fXMI0Nz73db7QJWaTEBaILtqszOeUJpYeORa2J1IAaV",
watchers: [
esbuild:
{Esbuild, :install_and_run, [:example, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:example, ~w(--watch)]}
{Esbuild, :install_and_run, [:example, ~w(--sourcemap=inline --watch)]}
]

# ## SSL Support
Expand Down
28 changes: 28 additions & 0 deletions elixir/phoenix/app/run_in_vm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

set -eu

export DATABASE_URL="ecto://postgres@localhost/phoenix_dev"
export PORT=4001
export APPSIGNAL_APP_NAME=elixir-phoenix
export APPSIGNAL_LOG_LEVEL=trace

# Load environment variables from env files
if [ -f /app/appsignal.env ]; then
set -a
. /app/appsignal.env
set +a
fi

if [ -f /app/appsignal_key.env ]; then
set -a
. /app/appsignal_key.env
set +a
fi

cd /app
mix local.hex --force
mix local.rebar --force
mix deps.get
mix ecto.migrate
mix phx.server