laradock refer to workspace directory path - docker

I have successfully installed Prince via the docker-compose.yml and I see the path + executable I need inside my workspace container but calling it out a number of ways in my Laravel .env will not find that path. In order to use prince I need to tell it where the PRINCE_EXECUTABLE_PATH is via the .env. What is the correct way to hit a directory in the workspace container from the Laravel app? I have tried to set a variable in the Laradock env and refer to it from laradock_workspace_1 and also just put the actual path in the env -- nothing seems to find it. What is the correct way?

Related

How to move a file 'to a directory that's on your PATH'?

Im trying to install a JSON formatter for Cucumber but am having trouble configuring it. The steps (listed here) go like this:
1. Download cucumber-json-formatter-darwin-amd64 and rename it to cucumber-json-formatter
2. Move it to a directory that's on your PATH
3. Make it executable with chmod +x cucumber-json-formatter
4. Verify that you can run it: cucumber-json-formatter --help
I have the file downloaded and renamed correctly. However, I am stuck on the second step of moving it to a directory thats on my PATH.
Doing some research, I know what the folder structure looks like but I'm not sure exactly what the step is instructing. How would I achieve this step? Can it be in ANY directory on my PATH? I am currently using a Mac if that makes any difference for the solution.
Move it to a directory that's on your PATH
PATH refers to the machine's environment variable named PATH. Any time the OS is asked to execute something PATH is searched.
On Windows open System Properties dialog, click Environment Variables button and Path is listed there. You can add a new entry for the location of cucumber-json-formatter or you can move it to an existing Path entry.

Why isn't telegraf reading environmental variables?

My goal is to put my telegraf config into source control. To do so, I have a repo in my user's home directory with the appropriate config file which has already been tested and proven working.
I have added the path to the new config file in the "default" environment variables file:
/etc/default/telegraf
like this:
TELEGRAF_CONFIG_PATH="/home/ubuntu/some_repo/telegraf.conf"
... as well as other required variables such as passwords.
However, when I attempt to run
telegraf --test
It says No config file specified, and could not find one in $TELEGRAF_CONFIG_PATH etc.
Further, if I force it by
telegraf --test --config /home/ubuntu/some_repo/telegraf.conf
Then the process fails because it is missing the other required variables.
Questions:
What am I doing wrong?
Is there not also a way of specifying a config directory too (I would like to break my file down into separate input files)?
Perhaps as an alternative to all of this... is there not a way of specifying additional configuration files to be included from within the default /etc/telegraf/telegraf.conf file? (I've been unable to find any mention of this in documentation).
What am I doing wrong?
See what user:group owns /etc/default/telegraf. This file is better used when running telegraf as a service via systemd. Additionally, if you run env do you see the TELEGRAF_CONFIG_PATH variable? What about your other variables? If not, then you probably need to source the file first.
Is there not also a way of specifying a config directory too (I would like to break my file down into separate input files)?
Yes! Take a look at all the options of telegraf with telegraf --help and you will find:
--config-directory <directory> directory containing additional *.conf files
Perhaps as an alternative to all of this... is there not a way of specifying additional configuration files to be included from within the default /etc/telegraf/telegraf.conf file? (I've been unable to find any mention of this in documentation).
That is not the method I would suggest going down. Check out the config directory option above I mentioned.
Ok, after a LOT of trial and error, I figured everything out. For those facing similar issues, here is your shortcut to the answer:
Firstly, remember that when adding variables to the /etc/default/telegraf file, it must effectively be reloaded. So for example using ubuntu systemctl, that requires a restart.
You can verify that the variables have been loaded successfully using this:
$ sudo strings /proc/<pid>/environ
where <pid> is the "Main PID" from the telegraf status output
Secondly, when testing (eg telegraf --test) then (this is the part that is not necessarily intuitive and isn't documented) you will have to ALSO load the same environmental variables into the current user (eg: SET var=value) such that running
$ env
shows the same results as the previous command.
Hint: This is a good method for loading the current env file directly rather than doing it manually.

Why is my dockerfile not copying directories

in my dockerfile I have these two lines:
ADD /ansible/inventory /etc/ansible/hosts
ADD /ansible/. /ansiblerepo
The first line works, as I can run the container and see my hosts file has been populated with all the ips from my inventory file.
The second line doesn't appear to be working though. I'm just trying to copy all the files/subdirectories of ansible and copy them over to the ansiblerepo directory inside the new container.
There are no errors while building the image, but again ansiblerepo is just an empty directory and nothing has copied over to it. I assume I'm just missing a back slash or something.
Docker ADD and COPY commands work relative to the build directly, and only for files in that directory that weren't excluded with a .dockerignore file. The reason for this is that builds actually run on the docker host, which may be a remote machine. The first step of a docker build . is to package up all the files in the directory (in this case .) and send them to the host to run your build. Any absolute paths you provide are interpreted as relative to the build directory and anything you reference that wasn't sent to the server will be interpreted as a missing file.
The solution is to copy /ansible to your build directory (typically the same folder as your Dockerfile).
Make sure that in your ".dockerignore" file, it does not excluded everything. usually, dockerignore file has these lines
*
!obj\Docker\publish\*
!obj\Docker\empty\
this means that everything is ignored except publish and empty folders.
Removing trailing /. from source directory should fix the ADD command.
On a related note, Docker Best Practices suggest using COPY over ADD if you don't need the URL download feature.

Fetching current path of the file using Ansible

In Ansible, i need to take a parent directory or current path of file automatically, in some of chef framework we have chef::config,it ll take automatically file path.
e.g:
/tasks/main.yml:
name: execute cmd
command: python file.py
If I have my "file.py" in a tasks folder, I need to execute my playbook from that path only like: /home/playbook/roles/sample/tasks ,then only it taking a script file and running.Suppose when i run from root path i mean /home/playbook/ path,it shows "No such file or directory"
I have tried lookup(env,HOME), It just takes /home alone but not related to that file path.
So to take a current file path how to give in ansible???
Thanks
Answer from comments
script module will copy the file first and then run it. if you use roles, you should place scripts into roles/my_role/files folder.

Permanently add bower proxy

How do I permanently add bower proxy to my system so I do not have to edit the .bowerrc file for every project and add
{
"proxy":"http://<proxy>:<port>",
"https-proxy":"https://<proxy>:<port>",
}
I have added the proxys to my OS with:
export HTTP_PROXY=http://<proxy_url>:<port>
export HTTPS_PROXY=http://<proxy_url>:<port>
But it seams bower does not get it. Thank you in advance for your response
Put the .bowerrc file in your home folder (it will work on Windows as well).
From http://bower.io/docs/config/:
Placement & Order
The config is obtained by merging multiple configurations by this
order of importance:
CLI arguments via --config
Environment variables
Local .bowerrc located in the current working directory
All .bowerrc files upwards the directory tree
.bowerrc file located in user’s home folder (~)
.bowerrc file located in the global folder (/)
Example of CLI arguments:
--config.endpoint-parser=
--config.storage.cache=
Example of valid environment variables:
bower_endpoint_parser is evaluated as endpoint-parser
bower_storage__cache is evaluated as storage.cache

Resources