In case docker-compose is very (very) slow, and if you run it on a virtual machine, check the entropy
If it is under 100 probably this is the problem.
One possible solution is to install an entropy daemon, like haveged
apt install -y haveged
I had this problem on a VM running at Scaleway.
A simple cron backup script of the databse in aws s3. Our script is called mysqlbackup.sh and it looks like this:
mysqldump --login-path=s3gallery --databases $DB | gzip > $BACKUPFILE
aws s3 cp $BACKUPFILE s3://backup.razvantudorica.net/$BACKUPFILE --profile backuper
And now a few explanations about the script.
First of all we need to have installed the awscli command.
Afterwords, as you can see, the database password is not hardcoded into the script. We can setup the password with
mysql_config_editor. This will store authentication credentials in an encrypted login file named .mylogin.cnf.
For our example database,
razvantudorica, and database user
myuser, we can run
mysql_config_editor set --login-path=razvantudorica --host=localhost --user=myuser --password
The next step is to configure aws s3 bucket and credentials.
- Create a bucket in s3, in our example is called
- Create the IAM credentials and save them in
- The last step is to test our script. If no error occurs at running and the backup file is uploaded successfully in S3, then everything is correct and we can add it the crontab list.
crontab -e and add this line
0 1 * * * /root/mysqlbackup.sh >> /var/log/mysqlbackup.log
Using symfony (5) console command to create new migration based on my entities, I encountered this error.
php bin/console doctrine:migrations:diff
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.
The simplest solution is to add mapping_types in config\packages\doctrine.yml
TornadoWeb is a great non-blocking web server written in Python and Boto3 is the Amazon Web Services (AWS) SDK for Python, which allows developers to write in a very easy manner software that makes use of Amazon services like S3. Unfortunately boto3 S3 wrapper is blocking and if you would just use it out of the box in a Tornado application it will block the main thread because it uses a synchronous HTTP client.
Continue reading Upload asynchronously to Amazon S3 using Tornado
Cherrymusic is a music streaming server written in python.
We assume the deployment is done in /home/user/music.domain.com
1. Go to the deployment folder and clone the cherrymusic repo
git clone https://github.com/devsnd/cherrymusic
2. Create and enable the virtualenv
python3 -m venv music_env
3. Test if the cherrymusic server starts and stop it afterwords
python cherrymusic --setup --port 8080
4. If you executed this commands under another user than the one under which you want to run cherrymusic
(eg: you ran the commands as root but you want to run under the user `user`)
mkdir -p /home/user/.config/cherrymusic
cp ~/.config/cherrymusic/cherrymusic.conf /home/user/.config/cherrymusic/
5. Edit cherrymusic.conf from the `user`’s home and set the `basedir` with the path where your music collection is stored.
Continue reading Deploy cherrymusic using Nginx, Supervisord and Virtualenv on Ubuntu