1.Push本地的项目到GitLab

  准备工作:由于之前在MySQL设置时禁止了root用户的远程访问,此处需要授权一个新的用户

mysql> GRANT ALL PRIVILEGES ON *.* TO 'py3web'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

#新建数据库

  mysql> CREATE DATABASE pyblog DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
  Query OK, 1 row affected (0.01 sec)

  本地项目初始目录

    CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  在GitLab上新建项目

    CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  push本地项目到GitLab

admin@DESKTOP-BC8FMN2 MINGW64 /e/python
$ cd my-blog/

$ git init
Initialized empty Git repository in E:/python/my-blog/.git/

$ git remote add origin git@192.168.23.211:root/my-blog.git

$ git add .

$ git commit -m "initial code"

admin@DESKTOP-BC8FMN2 MINGW64 /e/python/my-blog (master)
$ git push -u origin master
Counting objects: 117, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (113/113), done.
Writing objects: 100% (117/117), 1.35 MiB | 7.15 MiB/s, done.
Total 117 (delta 14), reused 0 (delta 0)
remote: Resolving deltas: 100% (14/14), done.
To 192.168.23.211:root/my-blog.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

2.创建Jenkins的pipeline-job

  创建步骤

    CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  基本设置

      CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

   构建触发器

      CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  流水线构建

      CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  重新保存下设置。

  同样的,需要将 Build Triggers里的GitLab CI Service URL http://192.168.23.211:8080/project/blog-pipeline-job 和 Secret Token 配置到GitLab的该git项目的settings-->intergrations中

      CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  此时需要在项目中添加下Jenkinsfile,以便后面的调试

      CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  提交后,Jenkins这边就已经自动触发了

      CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  执行完成后可以看到流水线记录

      CentOS7下的Django2集成部署五:Jenkins的流水线部署pipeline-job

  基本上pipeline已经就绪了

3.初步调试构建

  给my-blog项目配置nginx的conf

[root@home-ct75211 ~]# vim /etc/nginx/conf.d/my_blog.conf
 1     server {
 2         listen       80;
 3         server_name  www.my-blog.cc;
 4 
 5         #charset koi8-r;
 6 
 7         #access_log  logs/host.access.log  main;
 8 
 9         location / {
10             include  uwsgi_params;
11             uwsgi_pass  127.0.0.1:21190;         
12             uwsgi_param UWSGI_SCRIPT luffy_blog.wsgi;
13             uwsgi_param UWSGI_CHDIR  /usr/share/nginx/html/my_blog;
14             index  index.html index.htm;
15             client_max_body_size 35m;
16             #uwsgi_cache_valid 1m;
17             #uwsgi_temp_file_write_size 64k;
18             #uwsgi_busy_buffers_size 64k;
19             #uwsgi_buffers 8 64k;
20             #uwsgi_buffer_size 64k;
21             #uwsgi_read_timeout 300;
22             #uwsgi_send_timeout 300;
23             #uwsgi_connect_timeout 300;
24         }
25 
26         #error_page  404              /404.html;
27 
28         # redirect server error pages to the static page /50x.html
29         #
30         error_page   500 502 503 504  /50x.html;
31         location = /50x.html {
32             root   html;
33         }
34 
35 
36     }
/etc/nginx/conf.d/my_blog.conf
[root@home-ct75211 ~]# systemctl restart nginx

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-12-19
  • 2021-10-14
  • 2021-04-30
  • 2022-01-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2021-10-04
相关资源
相似解决方案