Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
fix issue #53
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Aug 21, 2018
1 parent 42f90a4 commit c6e70b3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ RUN \

# fix postgres-9.6 instead of 9.5
&& sed -i -e "s/postgresql postgresql\-contrib /postgresql\-9\.6 postgresql\-contrib\-9\.6 postgresql\-client\-9\.6 /g" /tmp/vst-install-ubuntu.sh \
&& echo "echo \$vpass > /root/.my.pass" >> /tmp/vst-install-ubuntu.sh \

# begin install vesta
&& bash /tmp/vst-install-ubuntu.sh \
Expand Down Expand Up @@ -430,7 +431,7 @@ RUN \

# for letsencrypt
&& touch /usr/local/vesta/data/queue/letsencrypt.pipe \

# setup redis like memcache
&& sed -i -e 's:^save:# save:g' \
-e 's:^bind:# bind:g' \
Expand Down
7 changes: 7 additions & 0 deletions rootfs/etc/my_init.d/startup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

export TERM=xterm
MYPASS=

if [ ! -f /home/admin/bin/my-startup.sh ]; then
echo "[i] running for the 1st time"
Expand All @@ -12,6 +13,8 @@ if [ ! -f /home/admin/bin/my-startup.sh ]; then
# save some bytes, you can do it later
# rm -rf /sysprepz
# rm -rf /vesta-start

MYPASS=$(</root/.my.pass)
fi

# restore current users
Expand Down Expand Up @@ -55,3 +58,7 @@ if [ -f /bin/vesta-auto-ssl.sh ]; then
echo "[i] running /bin/vesta-auto-ssl.sh"
bash /bin/vesta-auto-ssl.sh
fi

if [ ! -z "$MYPASS" ]; then
./home/admin/bin/mysqlinit.sh $MYPASS
fi
27 changes: 27 additions & 0 deletions rootfs/sysprepz/admin/bin/mysqlinit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
#
#
chmod 777 /var/run/mysqld/mysqld.sock

echo "[mysqld]" > /etc/mysql/conf.d/down.cnf
echo "skip-grant-tables" >> /etc/mysql/conf.d/down.cnf

MYSQL_ROOT_PASSWORD=$1

/etc/init.d/mysql restart

# initialize users
mysql -uroot -e \
"use mysql; \
DELETE FROM mysql.user WHERE User='root' ; \
FLUSH PRIVILEGES ; \
CREATE USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;\
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;\
FLUSH PRIVILEGES ;\
"

rm -f /etc/mysql/conf.d/down.cnf

/etc/init.d/mysql restart

exit 0

0 comments on commit c6e70b3

Please sign in to comment.