(∩_∩)O ha ha ~
Every original article has its own bitter process, I am no exception. Starting with the Hexo blog template this Monday, I was intrigued by the framework, which is all static files. When we learned Java, we were still in all kinds of JSP, but later with the popularity of Springboot began to write Thymeleaf, it felt too B. After 18 years of working with the MVVM framework, I felt I was too low to write HTML.
Last week, I received a notice from Tencent cloud client that the registered domain name did not pass the audit, and did not add the registered link information, which was rectified within a limited time. ε=(´ο ‘*))) Alas, AT a loss. Before I did a number of systems, some for friends, some for their own practice, several large and small, all need a variety of background deployment, including Redis, mysql and so on. Think about your 1G2H small server, too toss about.
Two or three months ago, I started to contact Spring Cloud, and then docker technology in December, 20 years ago. I thought why I didn’t record all the pits in my use, so I started a blog to rectify the record information.
As a result, various Baidu “bloggers” immediately liked Hexo, just as they had some front-end experience, so they started to climb the pit.
Day01
The whole day of climbing is a mistake in my mind. I have never touched blog before, thinking that blog is the same as back-end code. Since there are various gods who have written Docker deployment, they must also be able to run docker Run in server. Various Baidu “dpcler build hexo”, found N dockerfiles. As a result, a build on the server does not run.
Finally, I figured out how to build a hexo blank environment.
Dockerfile
FROM NODE:12.18
RUN npm --registry=https://registry.npm.taobao.org install hexo-cli -g
Copy the code
cd /usr/local/src && docker build -t hexo-blog .
docker images
docker run -it -d -p 4000:4000 -v /var/local/blog:/blog hexo-blog
docker ps -a
docker exec it hexo-blog hexo-blog /bin/bash
hexo init blog
cd /blog
npm install
hexo s
Copy the code
Then use the Internet http://81.*.*.1:4000 in the browser and see Hello World. Excited ah ┭┮﹏┭┮
If a friend wants to use Docker to run hexo, I suggest initializing NPM and hexo just like mine. Of course, a lot of great gods wrote things like:
FROM node:latest
MAINTAINER XueAohui [email protected]
ENV REFRESHED_AT 2017-03-26
VOLUME ["/opt/website"]
RUN npm install -g hexo
RUN hexo init /opt/website
WORKDIR /opt/website
EXPOSE 4000
Copy the code
For a configuration like the one above, where there are pits:
- For those of you who have front-end experience and are compulsive upgraders (I have severe ocD), upgrading Node 15 forces python2.7 to be installed. Git Clone source code will be used to compile NPM install. So the pitfall is that once you write this, you will find various prompts when NPM install that Python does not have environment variables.
- “RUN hexo init /opt/website”, “RUN hexo init /opt/website”, “RUN hexo init /opt/website” Maybe IT’s because I haven’t been with Docker long enough to find a reason why the Hexo Init blog is not executed.
- WORKDIR /opt/website this must be attached to the external scroll, but when docker run, -v is also added, but the disk does not have this directory.
So the easiest and easiest way to do this was to start it manually, and day01 finally started with port 4000.
Day02
Docker run nginx, domain name application SSL) OK, HTTPS //www.xuct.com.cn access is finally OK. If you’ve ever written code, you know, Hello World.
docker exec -it hexo-blog /bin/bash apt-get update apt-get install -y vim cd blog cd /sorce/_posts/ rm -fr * cd .. /.. hexonew "hello-world"
cd /sorce/_posts
vi hello-world.md
# "hello world"cd .. /.. hexo clean hexo g hexo sCopy the code
For Linux to use a novice I can not operate the above is painful, fortunately is the browser to access the domain name, really give force out. But still want to continue to write something in Hello World, again into the container VI. Then I realized that wasn’t the case at all, editing.md files in a Docker container to make myself unhappy.
So by:
win + R
cmder
e:
mkdir workspace_blog
cd workspace_blog
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo clean
hexo s
Copy the code
HTTP :localhost:4000, hello World. Hexo clean, hexo g, right click to zip public folder, SCP -p 22 public.zip root@81… : / var/WWW/blog.
Browser access to the domain name works. Here’s a list of search development tools. Here’s mine:
-
Typora MD’s editing tool
-
PicGo image upload tool with the above tools
-
Vc code Edit the configuration file
-
Cmder Window is an alternative to CMD
-
xshell
After hello World, I immediately started to download the skin: Yilia (small white, can only follow the post step by step). After downloading, I immediately started to change the skin, and you can search for specific modifications on some configurations. After deploying the domain name, I found that there was no place to write the domain name record, so I set up the blog for this purpose. I immediately went to soruce-src, modified footer.js, and added it
< div class = "BeanAn" > < img SRC = "/ img/bean. PNG" / > < a href = "" > ningxia * * * * * * * * < / a > < / div > < style >. BeanAn {display: flex; text-align: center; } </style>Copy the code
After the deployment, the style is corrupted, the image is not loaded, and there is a badJS error. Very broken. By this time, it was already past 7pm, and MY personality was not to go home until I finished the work. Immediately, I continued to search “Hexo Yilia to add a record” on Baidu, with various posts and answers. The episode in the middle is not the same as the final result, which is to find a style modified by the great god for Yilia:
https://github.com/lete114/hexo-theme-yilia-pro Copy the code
After the replacement deployment found the style is very good, then all kinds of build github map bed, replace the configuration and so on, finally deployment access, good good (O(∩_∩) haha ~) good mood. F12: error 404 (badjs 404) To raise issues to the author, I want Daniel to clear the badJS report part. May be too vegetables, god did not pay attention to me, now the problem is still:
https://github.com/lete114/hexo-theme-yilia-pro/issues Copy the code
Later, I do not know where to open a post, saying that the compilation of good man.js about badJS report empty, this is really a mountain of water to answer doubt no way to another village, according to the gods prompt search: listen, cool heart. Function 192 = 192 function 192 = 192 function 192 = 192 function 192 = 192 function 192 = 192 function 192
192:function(e,t,n){}, 192:function(e,t,n){}, 192:function(e,t,n){},193Copy the code
In this way, day02 days to skin, do not report errors under the premise of completion.
Day 03
Today is the third day (that is today), I randomly click my blog and find that there is no notification after writing the comment in Hello World. Then I search “Valine Reply” and sure enough I find the post of Valine-admin. Well, when you get this, start following the thread.
Here is the link. You can fork to your own repository and download it and modify it yourself.
https://github.com/jianhao2010303/Valine-Admin-Server Copy the code
If you want to wake up leanCloud on Github, you’re not going to be able to use action.
https://github.com/jianhao2010303/watch-leancloud Copy the code
I wrote a Java version of timed wake up, wrapped it in Docker, threw it to the server and ran. If any of you know how to use the current Github action, please let me know.
A brief summary of the bitter process
So far, the blog is deployed, comment management is configured, and Diandian is fine. I clicked on Lete’s blog and found out how cool the link blog was, so… Due to time constraints, Hexo will continue the second blog crawl (about deploying navigation blog: nav.xuct.com.cn, Configuring CDN for Cloud, configuring PigGo Map bed, etc.) tomorrow.
Ok, today’s content to share here, rest for two days.
2021.01.29 Written in the company
This article is published by OpenWrite, a blogging tool platform