Hot answers tagged

12

There are options you can pass through apt-get to dpkg that will handle the config choices. We usually do something like: apt-get install -y --no_install_recommends -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' <package_name> When using ansible you can do: apt: pkg: "{{ item }}" only_upgrade: yes ...


5

wrong argument order to su $ZOO_USER needs to be the first argument to su with the "$@" coming afterwards. su -c "$0" "$ZOO_USER" "$@" It is ok for the options to come before the username. It is a good idea to keep them in double quotes so that there aren't issues if someone accidentally puts spaces into it. Your error message reinforces that this is an ...


3

With the release of macOS Catalina (10.15) Apple has switched to Zsh as default shell (instead of Bash). Instead of setting PS1 in Bash you can set PROMPT in Zsh: PROMPT="${orange}%n"


3

You can run the container in detached mode by passing -d or --detach with the run command: https://docs.docker.com/engine/reference/run/#detached-vs-foreground


3

Surprisingly indeed GitLab works weirdly with the env vars. It evaluates them internally, though it shouldn't in my view. Value set as (in project Settings > CI/CD > Variables): 'aaa$bbb*%' becomes 'aaa*%' (with single quotes left!) Couple of of proof links: https://gitlab.com/gitlab-org/gitlab-ce/issues/45173#note_101659865 https://gitlab.com/gitlab-org/...


3

The issue is that prereqs-ubuntu.sh uses bash to install the npm. While the RUN directive uses sh to run the commands. Where is the npm installed root@2cd4a6af90f4:/app# type npm npm is /root/.nvm/versions/node/v8.16.0/bin/npm The PATH for the RUN directive # echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin


3

There is no "right" or "wrong". If the commands work when you type them in, then they work, and we won't keep you from doing it. Everything else is opinion. Sure, there are some best practices, for example some people find it unwise to directly fetch scripts from a public (3rd party) website and execute those locally without having a look inside first. It ...


3

The su-exec program in this script is actually the Alpine version created by Natanael Copa. It is installed from the OP's Dockerfile on line 6. The Alpine su-exec program is a substitute for gosu. Both programs are used to enable execution of a command as a specific user with the same environment variables and permissions as would normally be available to ...


3

The vault docs mention a -field parameter for the read subcommand. So you should be able to put this into a shell script: SECRET=$(vault read -field foo secret/mysecret) Other vault docs use the vault kv get in the same way so you might try: SECRET=$(vault kv get -field foo secret/mysecret)


3

You are running into a conflict between jenkins nature of making sure everything is done before a job is complete and your desire for some long-running things to be asynchronous. There is no right answer here, both are reasonable desires, but you and jenkins are pulling in different directions. It may be ok for some parts of the jenkins job to not be ...


2

Please refer to bash initialization process. https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html In your Dockerfile, at lines 12-14 you are patching files, but do not activate any of rbenvs. Later at your last RUN call, you finally ARE activating an rbenv. This starts pointing at that specific version of ruby (I thin this patches root ...


2

Negation to the rescue: sed -i "s/server.address=[^\ ].*\ /server.address=${SERVER_ADDRESS} /g" This is telling to search zero or more characters (.*) NOT matching whitespace ([^\ ]) up to the first whitespace. A good pattern is not to use real values to be replaced (10.111.11.11:3197) but to use a mark like ###SERVER_ADDRESS###. If something goes wrong ...


2

You could try to use docker compose and the docker compose "extra_hosts" tag, as described on the docker compose specification at https://docs.docker.com/compose/compose-file/. extra_hosts Add hostname mappings. Use the same values as the docker client --add-host parameter. extra_hosts: "somehost:162.242.195.82" "otherhost:50.31.209....


2

Try using GNU Screen or Tmux. These are called "screen multiplexers" but you'd get a number of benefits The commands you run will continue running even if you disconnect, or you have network related connection drops. Both software allow "re-attaching" to the running session Command outputs will persist in memory. You can start a long running command, log ...


2

Whoever created basex/basexhttp:latest does not seem to know Docker very well. They copied files necessary to a directory that was later configured as a volume, which means it can only be bound to an anonymous volume, otherwise files inside will be removed. They left source code inside the image, they used a single stage build with maven:3-jdk-8-alpine as ...


2

Well... you would need to know what IP address you actually want. Is it a public IP address? Is it a private subnet address? Do you only have 1 IP address? A few things you would need to figure out. But, if we just assume that we want to have whatever ip address your VM thinks it's address is then: Add the following to your .bashrc PS1="\[$(tput setaf 33)\...


2

This has already been covered a bit in the comments, but I figured I'd lay out a more extensive answer. Is there a way to automate that / shorten the amount of lines code (the actual script-file is much bigger in principle), maybe even from some built-in behavior in Apache itself and without involving further software? You can use a2ensite as a ...


2

One possible issue is that the NVM install script only writes the commands to set itself up to either .bash_profile OR .bashrc. Depending on your systems configuration, it may only be setup for interactive shells, not ones spawned by other programs (more info). Sourcing the nvm setup script can be a good option, as a previous comment noted. If you have a ...


2

This is typically done with a script, not the Dockerfile. The script (perhaps in bash or python) can run at build time to determine what environment it is in, and act accordingly. This can be included in the RUN command, but it risks becoming quite complex and difficult to read in the Dockerfile. Furthermore, each additional RUN or CMD entry in the ...


2

There's a few things to note. First is that in the absense of a shebang being supplied, the actual interpreter that will be used is actually "sh", not "bash". Taking a look at the Jenkins source for the BourneShellScript task, what happens is that Jenkins does not actually return the exit code from the subshell - it monitors a file called ...


1

Your configuration refers to a file that is local on your system, but does not exist on the jenkins server. The error message is trying to tell you this. /c/Users/D35N/Downloads/GitHubProjeckt/Automation/GitHubProjeckt/newharbortestkey is not on the jenkins server. You need to make this file available on the jenkins server by copying it up there, and it ...


1

The usual way to do that is to use a service manager (systemd or supervisord) to handle the service lifecycle (keeping the consul program running and restarting it if it fails for exemple) there's cookbooks existing to help creating those service units. The cheap alternative if you count on chef running periodically and handling that is to use nohup which ...


1

The general process of debugging inside the container is the same as debugging outside of one. The only thing that you generally need to know is that you can use docker exec to attach a bash shell inside a running container, or override the command with --entrypoint to launch bash instead, and then run the script manually. At that point, your question ...


1

While it's not clear what your trying to do (the script you have so far for the bit you are having trouble with would probably be handy), I think you are essentially just trying to parse your environment and manipulate the variables at the start of your script? I don't see why add something like this to the first line of your script wouldn't work: eval $(...


1

Makefile all: test dosomething test: @echo "hello" dosomething: @if [ "a" = "a" ]; then\ echo "world";\ exit 0;\ fi Running: make will return: hello world


1

This is not answering only the question but also a bit more (I put this here for reference): I found out a decent way to tackle this and some complications coming afterwards... (after hours and hours of fiddling) - e.g. to execute the script in an SSH session: deploy job: variables: # the variables could come from anywhere (e.g. GitLab Settings - ...


1

You can do this using perl For Example perl -pi -e "s/server.address=localhost/server.address=${SERVER_ADDRESS}/g" file_path This command change server address value localhost to vaariable value. Hope this works


1

You should regenerate this file from a template using your configuration management system of choice. You could also write a shell script that uses a heredoc to do the same thing. But since we're in DevOps-land you really should be using your configuration management system for these things.


1

You can use below. [user@xyz ~]$ hh='mysql.username=USERNAME';echo $hh | awk -F"=" '{OFS=FS}{ $2="Mango"; print }' mysql.username=Mango


1

You can obtain old parameters from the properties file before using sed, e.g. # get old parameters $ export oldUsername=$(grep mysql.username $FILE | cut -d'=' -f2) $ export oldPass=$(grep mysql.pass $FILE | cut -d'=' -f2) # set new parameters $ export newUsername=NEW_USERNAME $ export newPass=NEW_PASS # change parameters $ sed -i "s/$oldUsername/$...


Only top voted, non community-wiki answers of a minimum length are eligible