Skip to content

Instantly share code, notes, and snippets.

@congto
Last active April 20, 2017 03:02
Show Gist options
  • Save congto/15b566158823192d7303940347ec7631 to your computer and use it in GitHub Desktop.
Save congto/15b566158823192d7303940347ec7631 to your computer and use it in GitHub Desktop.
ghichep-cachet.md

note cai dat cachet tren ubunut 14.04

su - 
  • Cai dat Mysql
sudo apt-get install -y mariadb-server
  • Dang nhap vao DB
mysql -u root -p
  • Tao DB
CREATE DATABASE dbcachet;
GRANT ALL PRIVILEGES ON dbcachet.* TO 'ucachet'@'localhost' IDENTIFIED BY 'mat_khau'; 
GRANT ALL PRIVILEGES ON dbcachet.* TO 'ucachet'@'127.0.0.1' IDENTIFIED BY 'mat_khau'; 
GRANT ALL PRIVILEGES ON dbcachet.* TO 'ucachet'@'%' IDENTIFIED BY 'mat_khau'; 
FLUSH PRIVILEGES; 
QUIT;
  • Khoi dong lai DB
service mysql restart 
  • Cai dat goi phu tro
sudo apt-get -y install git curl apache2 php5 libapache2-mod-php5 php5-gd php5-apcu php5-mcrypt php5-cli php5-mysql
  • Cau hinh apache2
sudo a2enmod rewrite
  • Tai cachet
cd /var/www/html/
git clone https://github.com/cachethq/Cachet.git
cd Cachet
git checkout v2.3.10
  • Phan quyen cho thu muc
sudo chown www-data:www-data -R /var/www/html/Cachet/
  • Cau hinh cho cachet
mv .env.example .env
  • Sua file .evn, thay cac dong sau thanh thong so cua ban
APP_URL=http://ip_may_chu_cachet
APP_KEY=SomeRandomString

DB_DATABASE=ten_Database
DB_USERNAME=ten_tk_Database
DB_PASSWORD=mat_khau
  • Cai dat Composer
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer 
 
sudo composer install --no-dev -o
  • Tao key cho ung dung, sau khi chay lenh duoi, tham so APP_KEY trong file .env se duoc thay the.
php artisan key:generate

php artisan app:install
  • Cau hinh web cho cachet
touch /etc/apache2/sites-available/cachet.conf
sudo ln -s /etc/apache2/sites-available/cachet.conf /etc/apache2/sites-enabled/cachet.conf
  • Su dong
cat << EOF> /etc/apache2/sites-available/cachet.conf
<VirtualHost *:80>
ServerName status.hocchudong.com
# Or whatever you want to use
ServerAlias www.your-domain.com
# Make this the same as ServerName
DocumentRoot "/var/www/html/Cachet/public"
<Directory "/var/www/html/Cachet/public">
    Require all granted 
    # Used by Apache 2.4
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>
EOF
  • Restart apache
sudo service apache2 restart
  • Truy cap vao dia chi IP cua may chu cachet de cai dat tiep.

Cài đặt queue

apt-get install supervisor
  • Khởi động lại
service supervisor restart
  • Tạo file /etc/supervisor/conf.d/cachet.conf
cat << EOF > /etc/supervisor/conf.d/cachet.conf
[program:cachet-queue]
command=php artisan queue:work --daemon --delay=2 --sleep=1 --tries=3
directory=/var/www/html/Cachet
redirect_stderr=true
autostart=true
autorestart=true
EOF
  • Xóa cache sau khi reconfig cachet
cd /var/www/html/Cachet/
php artisan config:cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment