testing various configs without success

This commit is contained in:
Cristi Ene 2021-10-08 17:26:37 +03:00
parent fd77df017c
commit 7cc8e248ba
4 changed files with 166 additions and 41 deletions

View File

@ -6,15 +6,23 @@ RUN apt-get install -y build-essential
RUN apt-get install -y curl RUN apt-get install -y curl
RUN apt-get install -y python-minimal RUN apt-get install -y python-minimal
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
#needed for npm
RUN apt-get install -y nodejs RUN apt-get install -y nodejs
WORKDIR /simulator WORKDIR /simulator
ADD . /simulator ADD . /simulator
RUN rm package-lock.json && rm -rf node_modules && rm -rf ~/.node-gyp
RUN apt-get install -y libasound2-dev RUN apt-get install -y libasound2-dev
RUN npm i -g node-gyp RUN npm i -g node-gyp
RUN apt install -y alsa-base pulseaudio RUN apt install -y alsa-base pulseaudio
RUN apt-get install -y avahi-utils
RUN apt-get install -y alsa-utils
# RUN modprobe snd_bcm2835
RUN npm install --unsafe-perm RUN npm install --unsafe-perm
RUN export "PULSE_SERVER=unix:/path/to/pulseaudio/socket"
# docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --device /dev/snd # docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --device /dev/snd

View File

@ -3,10 +3,36 @@
> openssl: 1.0.2g<br/> > openssl: 1.0.2g<br/>
> node: 8.16.0 > node: 8.16.0
## Run in docker
```
docker build -t linx-simulator .
docker run -it --rm linx-simulator
NODE_TLS_REJECT_UNAUTHORIZED='0' node ./index.js --path="./config/dev/"
```
Errors because audio driver:
```
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
```
* [How audio on Linux works](https://comp0016-team-24.github.io/dev/problem-solving/2020/10/30/passing-audio-into-docker.html)
* `docker run -v /run/user/1000/pulse/native:/run/user/1000/pulse/native -e PULSE_SERVER=unix:/run/user/1000/pulse/native -u 1000:1000`
* [Play sound in docker on MacOS](https://stackoverflow.com/questions/40136606/how-to-expose-audio-from-docker-container-to-a-mac)
* [Use sound in docker from Linux](https://volkanpaksoy.com/archive/2019/12/05/Using-Audio-in-Docker-Container/)
* [SO - run apps using audio in a docker container](https://stackoverflow.com/questions/28985714/run-apps-using-audio-in-a-docker-container/28995539#28995539)
* run with `-v /run/user/$UID/pulse/native:/path/to/pulseaudio/socket`
## Requirements: ## Requirements:
```sh ```sh
curl -sL [https://deb.nodesource.com/setup_8.x](https://deb.nodesource.com/setup_8.x) | sudo -E bash - curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs sudo apt-get install -y nodejs
sudo apt-get install -y build-essential sudo apt-get install -y build-essential
install python 2.7 install python 2.7
@ -18,9 +44,11 @@ sudo npm install --unsafe-perm
## How to guide how to configure units and the simulator ## How to guide how to configure units and the simulator
<br/>
**1. Insert Groups** <br/> ### 1. Insert Groups
Groups will be inserted using the following script directly on the database: Groups will be inserted using the following script directly on the database:
```sql ```sql
set search_path to public; set search_path to public;
@ -53,15 +81,19 @@ BEGIN
end; $$; end; $$;
``` ```
<br/>
**2. Insert units** <br/> ### 2. Insert units
The units will be inserted from the provisioning(**Units -> Import from file**) and the **file_name.xlsx** file will have the following format: The units will be inserted from the provisioning(**Units -> Import from file**) and the **file_name.xlsx** file will have the following format:
![FILE.XLSX Format](./doc/units-xlsx.png) ![FILE.XLSX Format](./doc/units-xlsx.png)
<br/>
**3. Simulator configuration:** <br/> ### 3. Simulator configuration
For the simulation to simulate **in a period**, we must put the **delay_between_clients setting in settings** (the value is in milliseconds).<br/> For the simulation to simulate **in a period**, we must put the **delay_between_clients setting in settings** (the value is in milliseconds).<br/>
Example in **config**:<br/> Example in **config**
```toml ```toml
[mumble] [mumble]
port = '5668' port = '5668'

58
Vagrantfile vendored
View File

@ -12,7 +12,22 @@ Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for # Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search. # boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/xenial64" # config.vm.box = "base"
config.vm.box = "ubuntu/hirsute64"
# require plugin https://github.com/leighmcculloch/vagrant-docker-compose
# config.vagrant.plugins = "vagrant-docker-compose"
# install docker and docker-compose
config.vm.provision :docker
# config.vm.provision :docker_compose
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end
# Disable automatic box update checking. If you disable this, then # Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs # boxes will only be checked for updates when the user runs
@ -37,34 +52,25 @@ Vagrant.configure("2") do |config|
# Create a public network, which generally matched to bridged network. # Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on # Bridged networks make the machine appear as another physical device on
# your network. # your network.
config.vm.network "public_network" # config.vm.network "public_network"
config.ssh.forward_x11 = true
config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is # Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is # the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third # the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options. # argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data" # config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder ".", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various # Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options. # backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox: # Example for VirtualBox:
# #
config.vm.provider "virtualbox" do |vb| # config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine # # Display the VirtualBox GUI when booting the machine
# vb.gui = true # vb.gui = true
# vb.customize [ #
# "modifyvm", :id, # # Customize the amount of memory on the VM:
# "--audio", "coreaudio", # vb.memory = "1024"
# "--audiocontroller", "hda" # end
# ]
# Customize the amount of memory on the VM:
vb.memory = "2024"
end
# #
# View the documentation for the provider you are using for more # View the documentation for the provider you are using for more
# information on available options. # information on available options.
@ -76,18 +82,4 @@ Vagrant.configure("2") do |config|
# apt-get update # apt-get update
# apt-get install -y apache2 # apt-get install -y apache2
# SHELL # SHELL
end
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get -y install dkms
# #https://wiki.ubuntu.com/Audio/UpgradingAlsa/DKMS
# wget http://ppa.launchpad.net/ubuntu-audio-dev/alsa-daily/ubuntu/pool/main/o/oem-audio-hda-daily-dkms/oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# sudo dpkg -i oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# rm oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# sudo apt-get -y install python-dev ipython python-numpy python-matplotlib python-scipy cython alsa-utils paman
# sudo usermod -a -G audio vagrant
# SHELL
config.vm.provision "shell", path: "install.sh", privileged: true
end

93
Vagrantfile.bak Normal file
View File

@ -0,0 +1,93 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/xenial64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network"
config.ssh.forward_x11 = true
config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder ".", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
# vb.customize [
# "modifyvm", :id,
# "--audio", "coreaudio",
# "--audiocontroller", "hda"
# ]
# Customize the amount of memory on the VM:
vb.memory = "2024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get -y install dkms
# #https://wiki.ubuntu.com/Audio/UpgradingAlsa/DKMS
# wget http://ppa.launchpad.net/ubuntu-audio-dev/alsa-daily/ubuntu/pool/main/o/oem-audio-hda-daily-dkms/oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# sudo dpkg -i oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# rm oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# sudo apt-get -y install python-dev ipython python-numpy python-matplotlib python-scipy cython alsa-utils paman
# sudo usermod -a -G audio vagrant
# SHELL
config.vm.provision "shell", path: "install.sh", privileged: true
end