Skip to content

Instantly share code, notes, and snippets.

@clarencetw
Created July 27, 2019 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarencetw/f1f21eb1eb360f6a4626157f13643a7c to your computer and use it in GitHub Desktop.
Save clarencetw/f1f21eb1eb360f6a4626157f13643a7c to your computer and use it in GitHub Desktop.
wordpress-from-gke-to-digitalocean
clarence$ kubectl get all
NAME READY STATUS RESTARTS AGE
pod/mysql-0000000000-AAAAA 1/1 Running 0 6d
pod/wordpress-0000000000-AAAAA 1/1 Running 0 6d
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.0.0.0 <none> 443/TCP 1y
service/mysql ClusterIP 10.0.0.0 <none> 3306/TCP 1y
service/wordpress LoadBalancer 10.0.0.0 35.197.0.0 80:31737/TCP 1y
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
deployment.apps/mysql 1 1 1 1 1y
deployment.apps/wordpress 1 1 1 1 1y
NAME DESIRED CURRENT READY AGE
replicaset.apps/mysql-0000000000 1 1 1 1y
replicaset.apps/wordpress-0000000000 1 1 1 1y
kubectl cp wordpress-0000000000-AAAAA:/var/www/html/ Downloads/var/www/html/
kubectl port-forward service/mysql 3306:3306
mysqldump --column-statistics=0 -h 127.0.0.1 -uroot -p -A --default-character-set=utf8 > mysql.sql
clarence@ubuntu:~$ sudo apt update
clarence@ubuntu:~$ sudo apt install nginx
clarence@ubuntu:~$ sudo apt install mysql-server
clarence@ubuntu:~$ sudo mysql_secure_installation
clarence@ubuntu:~$ sudo apt install php-fpm php-mysql php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip
clarence@ubuntu:~$ sudo vim /etc/nginx/sites-available/blog.com.tw
clarence@ubuntu:~$ sudo ln -s /etc/nginx/sites-available/blog.com.tw /etc/nginx/sites-enabled/
clarence@ubuntu:~$ sudo nginx -t
clarence@ubuntu:~$ sudo systemctl reload nginx
clarence@ubuntu:~$ sudo chown -R www-data:www-data /var/www/wordpress
clarence@ubuntu:~$ vim wp-config.php
/** MySQL hostname */
define('DB_HOST', '127.0.0.1:3306');
clarence@ubuntu:~/Download$ sudo mysql < mysql.sql
[sudo] password for clarence:
clarence@ubuntu:~/Download$ sudo mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.25-0ubuntu0.18.04.2 (Ubuntu)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SHOW DATABASES;
+---------------------+
| Database |
+---------------------+
| information_schema |
| #mysql50 |
| mysql |
| performance_schema |
| sys |
| wordpress |
+---------------------+
6 rows in set (0.00 sec)
mysql> exit
Bye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment