import logging
logging.basicConfig(filename='log.txt', format=logging.BASIC_FORMAT)
logging.error('OH NO!')
try:
raise Exception('Foo')
except:
logging.exception("Oops:")
-
http://stackoverflow.com/questions/15444695/how-to-log-into-a-file-for-a-python-bottle-web-serverToday I got a docker daemon not responding to commands (docker ps, docker run...)
Even after restarting service
In /var/log/docker I got this:
time="2017-03-01T08:28:58.43946917Z" level=fatal msg="open /var/run/docker/libcontainerd/containerd/81623262351dfc42c5e87aa8df11592a57f2d14a468476620c7c4d6c89de1958/state.json: no such file or directory"
The solution was to stop docker service, remove this /var/run/docker directory and restart docker service
-
https://links.infomee.fr/?vywQIwBeanstalk ne permet pas de définir un trigger basé sur le nombre d'éléments dans la queue SQS pour l'auto scaling des environements de type worker
Pourtant c'est possible mais il y a un peu de boulot :
http://docs.aws.amazon.com/autoscaling/latest/userguide/as-using-sqs-queue.html
https://forums.aws.amazon.com/thread.jspa?messageID=722589
On peut surement intégrer ça à beanstalk avec les .ebextensions (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html)
En plus d'être un peu complexe et pas vraiment intégrer à beanstalk, ça n'a pas l'air très réactif, cet article en parle et donne une solution :
Rapid Auto Scaling with Amazon SQS : https://aws.amazon.com/blogs/aws/auto-scaling-with-sqs/
-
http://docs.aws.amazon.com/autoscaling/latest/userguide/as-using-sqs-queue.htmlOr "how to search text in git diff history"
git log -p -S "string"
-
http://www.philandstuff.com/2014/02/09/git-pickaxe.htmlDepuis hier le 22 Février 2017
seems cool and powerful
-
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platforms.html
-
https://links.infomee.fr/?bERNcgSince December 22th 2016 you are able to configure application version lifecycle in Beanstalk.
Very convenient, we can trash our custom api cleaning scripts :-)
-
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-lifecycle.htmlDefault listener (80) is enabled by default, to disable it :
aws:elb:listener:
ListenerEnabled: false
-
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-elblistenerdocker stop command send SIGTERM to pid1 inside the container to let a chance to stop gracefully (https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/)
Unfortunatly some software ignore SIGTERM and need to be stopped by their own command (hello opendj)
To do so, in the Dockerfile, in the CMD, I use a script like this :
/thecommand/tostart/thesoftware/inbackground
trap "/thecommand/tostop/thesoftware" SIGTERM
while true; do sleep 1; done
so my script is run with PID1, docker stop sends SIGTERM, my script catch (trap) the signal, and run the command to stop gracefully
-
https://links.infomee.fr/?Mxx31Acat prepare-commit-msg
NAME=$(git branch | grep '' | sed 's/ //'|cut -d'/' -f2|cut -d'-' -f1,2)
echo "$NAME $(cat "$1")" > "$1"
for dir in $(ls); do cp prepare-commit-msg $dir/.git/hooks/prepare-commit-msg; done
text=" [FIX] ()
🔄 [MOD] ()
✅5 [ADD] ()
🔀 [TEST] ()
[DOC] ()"
echo "$text $(cat "$1")" > "$1"
-
https://links.infomee.fr/?GZFLaQDELIM=$(echo -en "\001");
sed -i "s${DELIM}SEARCH${DELIM}${VAR}${DELIM}" $config
-
https://links.infomee.fr/?3DXbegThe easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog...
git reflog
and to reset the current branch to it (with the usual caveats about being absolutely sure before reseting with the --hard option).
Suppose the old commit was HEAD@{5} in the ref log:
git reset --hard HEAD@{5}
-
http://stackoverflow.com/questions/134882/undoing-a-git-rebasePour avoir une vue globale des crins qui tournent sur différents serveurs
-
https://github.com/jamesrwhite/minicronTIL what is this offical repository :
Only debian with some useful package to build dependencies (needed when you install some gem for example)
For example ruby:2.3 Dockerfile use a buildpack-deps image
-
https://hub.docker.com/_/buildpack-deps/Several ways to get metadata (like ip address) when you're connected to an EC2:
/opt/aws/bin/ec2-metadata
-
https://links.infomee.fr/?-mOoAQJe me mets ça de côté pour gagner du temps la prochaine fois
logfile=/tmp/logfile.log
errorfile=/tmp/error.log
function log() {
echo -e "\e[34m\e[1m[$(date +%Y-%m-%d) $(date +%H:%M:%S)] $1\e[0m" | tee -a /tmp/logfile.log
}
function logerror() {
echo -e "\e[91m\e[1m[$(date +%Y-%m-%d) $(date +%H:%M:%S)] $1\e[0m" | tee -a /tmp/logfile.log
}
log "prout"
logerror "pwet"
-
https://links.infomee.fr/?tQ0ssA