Tech and non-tech docs related to the "infra" group.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

wordpress-with-docker-scripts.md 3.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. #### Wordpress with docker-scripts
  2. ##### 0. Diagram
  3. ![](img/wordpress-with-docker-scripts.png/wordpress-ds.png)
  4. <p/>
  5. ##### 1. Install dependencies
  6. <details>
  7. <summary>1. Install docker</summary>
  8. ```
  9. curl -fsSL https://get.docker.com -o get-docker.sh
  10. sudo sh get-docker.sh
  11. ```
  12. Reference: https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script
  13. </details>
  14. <details>
  15. <summary>2. Install docker-scripts</summary>
  16. ```
  17. apt install m4
  18. git clone https://gitlab.com/docker-scripts/ds /opt/docker-scripts/ds
  19. cd /opt/docker-scripts/ds/
  20. make install
  21. ds -v
  22. ds -h
  23. ```
  24. Reference: https://gitlab.com/docker-scripts/ds#installation
  25. </details>
  26. <details>
  27. <summary>3. Install Webserver Proxy</summary>
  28. ```
  29. ds pull wsproxy
  30. ds init wsproxy @wsproxy
  31. cd /var/ds/wsproxy/
  32. vim settings.sh
  33. ds make
  34. ```
  35. Reference: https://gitlab.com/docker-scripts/wsproxy#installation
  36. </details>
  37. <details>
  38. <summary>4. Install MariaDB</summary>
  39. ```
  40. ds pull mariadb
  41. ds init mariadb @mariadb
  42. cd /var/ds/mariadb/
  43. vim settings.sh
  44. ds make
  45. ```
  46. Reference: https://gitlab.com/docker-scripts/mariadb#installation
  47. </details>
  48. <p/>
  49. ##### 2. Install Wordpress sites
  50. <details>
  51. <summary>1. Install a wordpress container</summary>
  52. ```
  53. ds pull wordpress
  54. ds init wordpress @wordpress1
  55. cd /var/ds/wordpress1/
  56. vim settings.sh
  57. ds make
  58. ```
  59. Reference: https://gitlab.com/docker-scripts/wordpress#installation
  60. </details>
  61. <details>
  62. <summary>2. Install a site</summary>
  63. ```
  64. cd /var/ds/wordpress1/
  65. ds site
  66. ds site init site1.wp.fs.al
  67. ls
  68. ls site1.wp.fs.al
  69. ls apache2/sites-enabled/
  70. cat apache2/sites-enabled/site1.wp.fs.al.conf
  71. ls ../wsproxy/sites-enabled/
  72. cat ../wsproxy/sites-enabled/site1.wp.fs.al.conf
  73. ```
  74. ```
  75. vim site1.wp.fs.al/settings.sh
  76. ds site install site1.wp.fs.al
  77. ls site1.wp.fs.al/
  78. ```
  79. Try in browser https://site1.wp.fs.al and login as admin.
  80. Reference: https://gitlab.com/docker-scripts/wordpress#manage-a-website
  81. </details>
  82. <details>
  83. <summary>3. Install another site</summary>
  84. ```
  85. cd /var/ds/wordpress1/
  86. ds site init site2.wp.fs.al
  87. ls
  88. ls site2.wp.fs.al
  89. ls apache2/sites-enabled/
  90. ls ../wsproxy/sites-enabled/
  91. vim site2.wp.fs.al/settings.sh
  92. ds site install site2.wp.fs.al
  93. ls site2.wp.fs.al/
  94. ```
  95. Try in browser https://site2.wp.fs.al
  96. </details>
  97. <details>
  98. <summary>4. Install a second container</summary>
  99. ```
  100. ds init wordpress @wordpress2
  101. cd /var/ds/wordpress2/
  102. vim settings.sh
  103. ds make
  104. ```
  105. </details>
  106. <details>
  107. <summary>5. Install a site on the second container</summary>
  108. ```
  109. cd /var/ds/wordpress2/
  110. ds site init site3.wp.fs.al
  111. vim site3.wp.fs.al/settings.sh
  112. ds site install site3.wp.fs.al
  113. ls site3.wp.fs.al/
  114. ```
  115. Try in browser https://site3.wp.fs.al
  116. </details>
  117. <p/>
  118. ##### 3. Manage a Wordpress site
  119. <details>
  120. <summary>1. Clone and delete a site</summary>
  121. ```
  122. cd /var/ds/wordpress2/
  123. ds site clone
  124. ds site clone site3.wp.fs.al site4.wp.fs.al
  125. ```
  126. Try in browser https://site4.wp.fs.al
  127. ```
  128. ds site del
  129. ds site del site4.wp.fs.al
  130. ```
  131. </details>
  132. <details>
  133. <summary>2. Backup and restore a site</summary>
  134. ```
  135. cd /var/ds/wordpress2/
  136. ds backup
  137. ds backup site3.wp.fs.al
  138. ls -lh backup/
  139. ```
  140. ```
  141. ds site del site3.wp.fs.al
  142. ```
  143. Try in browser https://site3.wp.fs.al
  144. ```
  145. ds site init site3.wp.fs.al
  146. ls site3.wp.fs.al/
  147. ds restore
  148. ds restore site3.wp.fs.al backup/wordpress-site3.wp.fs.al-2020-07-29.tgz
  149. ```
  150. Try in browser https://site3.wp.fs.al
  151. </details>
  152. <details>
  153. <summary>3. Using wp-cli</summary>
  154. ```
  155. cd /var/ds/wordpress2/
  156. ds wp
  157. ds wp site3.wp.fs.al
  158. ds wp site3.wp.fs.al option
  159. ds wp site3.wp.fs.al option list
  160. ds wp site3.wp.fs.al option get siteurl
  161. ds wp site3.wp.fs.al option get home
  162. ```
  163. </details>
  164. <details>
  165. <summary>4. Working inside the container</summary>
  166. ```
  167. ds shell
  168. ls
  169. cd site3.wp.fs.al
  170. wp
  171. wp option get siteurl
  172. wp option get home
  173. ```
  174. </details>