Posted
on September 4, 2021, 6:02 pm,
by admin,
under
mysql.
Step 1
mysql> show variables like 'sql_mode' ;
| sql_mode | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Step 2
Add to mysqld.cnf
<pre lang="bash">
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
Step 3
Restart mysql
Posted
on February 9, 2020, 3:34 pm,
by admin,
under
bash,
linux.
# docker inspect -f "{{ .Mounts }}" aghayevcom
[{bind /home/user/Projects /home true rprivate} {bind /home/user/Servers /opt true rprivate}] |
Posted
on January 28, 2020, 3:16 pm,
by admin,
under
linux.
Copying files using rsync with progress bar
apt-get install rsync;
rsync -ah --progress /path/to/source /path/to/destination |
Run sql script to restore db with progress bar
apt-get install pv;
pv script.sql | mysql -h hostname -u username -p password database |
Posted
on January 27, 2020, 5:57 pm,
by admin,
under
linux.
Step 1. As a result of running the command it takes you inside newly created session
Step 2. Run your command and then press the combination below to exit the screen
Ctrl+A then D (after releasing Ctrl + A) |
Step 3
screen -ls
Output:
There is a screen on:
3132.sessionname (01/27/2020 05:50:32 PM) (Detached) |
Step 4. To reconnect into existing session screen
screen -R 3132.sessionname |
Step 5. To quit the screen session
Posted
on January 27, 2020, 4:29 pm,
by admin,
under
linux.
du -sh /var
du -sh mysql/*
du -sh . |
Posted
on January 24, 2020, 3:34 pm,
by admin,
under
apache,
mysql.
I had a problem with a container which wouldn’t start due to a bad config change I made. I was able to copy the file out of the stopped container and edit it. something like:
docker cp test-mysql:/etc/mysql/my.cnf . |
Edit it and copy back
docker cp my.cnf test-mysql:/etc/mysql/my.cnf
docker start mysql
docker exec -ti mysql bash |
Posted
on January 21, 2020, 1:18 pm,
by admin,
under
git.
git reset --hard origin/master |
Posted
on January 20, 2020, 12:42 pm,
by admin,
under
apache.
Step 1 – Dockerfile
FROM debian:jessie
MAINTAINER user@server.com
RUN apt-get update
RUN apt-get install -y vim
RUN apt-get install -y apache2
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server
RUN apt-get install -y php5
RUN apt-get install php5-mysql
RUN apt-get autoremove
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
EXPOSE 80
# Launch all services
# CMD ["apache2ctl", "-D", "FOREGROUND"]
COPY startup.sh /
RUN chmod 777 /startup.sh
CMD ["bash","/startup.sh"] |
Step 2 – Create startup.sh
cat > startup.sh
#!/bin/bash
apache2ctl -D FOREGROUND |
Step 3 – Building image
docker build -t aghayevcomdockerfile:latest . |
Step 4 – Check if image was created
REPOSITORY TAG IMAGE ID CREATED SIZE
aghayevcomdockerfile latest 19e27a7ca24b 11 minutes ago 389MB
debian jessie 5d7d9c6338e8 3 weeks ago 129MB |
Step 5 – Creating container
docker run -d -t -p 80:80 -p 443:443 -p 3306:3306 -v /home/user/Projects:/home -v /home/user/Servers:/opt --name aghayevcom aghayevcomdockerfile:latest |
Step 6 – Check if container created
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8946f43f47ea aghayevcomdockerfile:version1.0 "bash /startup.sh" 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp aghayevcom
p.s. Pay attention to COMMAND column, it should show which command will run first when u start container. In case of direct call of apache2ctl it shows this
#850703e85940 aghayevcomdockerfile:version1.0 "apache2ctl -D FOREG…" 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp aghayevcom |
Step 6 – Run container
docker start aghayevcom
p.s. It is possible to start container by direct calling Container ID
# docker start 8946f43f47ea |
Posted
on January 15, 2020, 5:02 pm,
by admin,
under
linux.
Mounting
mkdir ~/remoteDir
ssh-keygen -t rsa
ssh-copy-id -i .ssh/id_rsa.pub user@hostname
sudo apt install sshfs
sshfs user@hostname:/ ~/remoteDir |
Unmounting
fusermount -u ~/remoteDir |
Posted
on January 15, 2020, 11:04 am,
by admin,
under
linux.