Hot answers tagged

7

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

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 ...


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 ...


2

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

The su-exec program in this script is actually the Alpine version created by Natanael Copa. It is installed from the Dockerfile on line 6. The Alpine su-exec version 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 the ...


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

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/...


2

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


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 ...


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

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

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 ...


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/$...


1

I cannot say this is a the best answer so I do hope someone can provide a better clarification. It seems the default shell for sh() in Jenkins is Bourne. By updating the sh() with the correct shell this allows the below usage: sh'''#!/bin/bash IFS='/' branch=($1) # Use it. ''' This doesn't resolve the the redirection error. Also I would ...


1

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 secret/mysecret -field foo) Other vault docs use the vault kv get in the same way so you might try: SECRET=$(vault kv get secret/mysecret -field foo)


1

My current, less ideal solution to this is to run Jenkins in a terminal logged in to a desktop rather than as a service. I'd rather not have to do that but it has solved the problem entirely.


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