Skip to content

Commit d077133

Browse files
authored
Added ci (#8)
* Added files for ci * Update actions.yaml * Modify files for ci * Update actions.yaml
1 parent 7a6bf6c commit d077133

File tree

4 files changed

+246
-0
lines changed

4 files changed

+246
-0
lines changed

.github/workflows/actions.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
push:
3+
branches:
4+
- 'dev'
5+
6+
jobs:
7+
converge:
8+
name: Converge
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install werf
18+
uses: werf/actions/[email protected]
19+
20+
- name: Log in to registry
21+
# This is where you will update the personal access token to GITHUB_TOKEN
22+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
23+
24+
- name: Run echo
25+
run: |
26+
werf version
27+
docker version
28+
echo $GITHUB_REPOSITORY
29+
echo $GITHUB_SHA
30+
- name: Run Build
31+
run: |
32+
. $(werf ci-env github --as-file)
33+
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
34+
35+
# stage-deploy:
36+
# name: Deploy on stage
37+
# needs: converge
38+
# runs-on: ubuntu-latest
39+
# steps:
40+
# - name: ConfigCreate
41+
# run: |
42+
# mkdir ~/.kube/
43+
# echo "${{ secrets.KUBECONFIG }}" > config
44+
# mv config ~/.kube/
45+
# ls ~/.kube/
46+
# kubectl set image deployment/ -n stage

.github/workflows/tag.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
tags:
4+
- '[0-9]+.[0-9]+.[0-9]+'
5+
6+
jobs:
7+
converge:
8+
name: Converge
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install werf
18+
uses: werf/actions/[email protected]
19+
20+
- name: Log in to registry
21+
# This is where you will update the personal access token to GITHUB_TOKEN
22+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
23+
24+
- name: Run echo
25+
run: |
26+
werf version
27+
docker version
28+
echo $GITHUB_REPOSITORY
29+
echo $GITHUB_REF_NAME
30+
- name: Run Build
31+
run: |
32+
. $(werf ci-env github --as-file)
33+
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME --dev
34+
# prod-deploy:
35+
# name: Deploy on prod
36+
# needs: converge
37+
# runs-on: ubuntu-latest
38+
# steps:
39+
# - name: Run echo
40+
# run: |
41+
# echo "Tag was created - deploying on prod"
42+
# echo tag = $GITHUB_REF_NAME
43+
# - name: ConfigCreate
44+
# run: |
45+
# mkdir ~/.kube/
46+
# echo "${{ secrets.KUBECONFIG }}" > config
47+
# mv config ~/.kube/
48+
# ls ~/.kube/
49+
# kubectl set image deployment/ -n prod

nginx.conf

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
2+
worker_processes auto; #some last versions calculate it automatically
3+
4+
# number of file descriptors used for nginx
5+
# the limit for the maximum FDs on the server is usually set by the OS.
6+
# if you don't set FD's then OS settings will be used which is by default 2000
7+
worker_rlimit_nofile 100000;
8+
9+
# only log critical errors
10+
error_log /var/log/nginx/error.log crit;
11+
12+
# provides the configuration file context in which the directives that affect connection processing are specified.
13+
events {
14+
# determines how much clients will be served per worker
15+
# max clients = worker_connections * worker_processes
16+
# max clients is also limited by the number of socket connections available on the system (~64k)
17+
worker_connections 4000;
18+
19+
# optimized to serve many clients with each thread, essential for linux -- for testing environment
20+
use epoll;
21+
22+
# accept as many connections as possible, may flood worker connections if set too low -- for testing environment
23+
multi_accept on;
24+
}
25+
26+
http {
27+
# Temporary directories for kubernetes "readonlyfilesystem"
28+
client_body_temp_path /tmp/nginx-client-body;
29+
proxy_temp_path /tmp/nginx-proxy;
30+
fastcgi_temp_path /tmp/nginx-fastcgi;
31+
uwsgi_temp_path /tmp/nginx-uwsgi;
32+
scgi_temp_path /tmp/nginx-scgi;
33+
# cache informations about FDs, frequently accessed files
34+
# can boost performance, but you need to test those values
35+
open_file_cache max=200000 inactive=20s;
36+
open_file_cache_valid 30s;
37+
open_file_cache_min_uses 2;
38+
open_file_cache_errors on;
39+
40+
# to boost I/O on HDD we can disable access logs
41+
access_log off;
42+
43+
# copies data between one FD and other from within the kernel
44+
# faster than read() + write()
45+
sendfile on;
46+
47+
# send headers in one piece, it is better than sending them one by one
48+
tcp_nopush on;
49+
50+
# don't buffer data sent, good for small data bursts in real time
51+
tcp_nodelay on;
52+
53+
# reduce the data that needs to be sent over network -- for testing environment
54+
gzip on;
55+
# gzip_static on;
56+
gzip_min_length 10240;
57+
gzip_comp_level 1;
58+
gzip_vary on;
59+
gzip_disable msie6;
60+
gzip_proxied expired no-cache no-store private auth;
61+
gzip_types
62+
# text/html is always compressed by HttpGzipModule
63+
text/css
64+
text/javascript
65+
text/xml
66+
text/plain
67+
text/x-component
68+
application/javascript
69+
application/x-javascript
70+
application/json
71+
application/xml
72+
application/rss+xml
73+
application/atom+xml
74+
font/truetype
75+
font/opentype
76+
application/vnd.ms-fontobject
77+
image/svg+xml;
78+
79+
# allow the server to close connection on non responding client, this will free up memory
80+
reset_timedout_connection on;
81+
82+
# request timed out -- default 60
83+
client_body_timeout 10;
84+
85+
# if client stop responding, free up memory -- default 60
86+
send_timeout 2;
87+
88+
# server will close connection after this time -- default 75
89+
keepalive_timeout 30;
90+
91+
# number of requests client can make over keep-alive -- for testing environment
92+
keepalive_requests 100000;
93+
94+
include /etc/nginx/mime.types;
95+
96+
server {
97+
listen 80 default_server;
98+
root /usr/share/nginx/html;
99+
index index.html index.htm;
100+
server_name _;
101+
location / {
102+
aio threads;
103+
try_files $uri /index.html;
104+
}
105+
location /env.js {
106+
aio threads;
107+
add_header Cache-Control "no-cache";
108+
}
109+
location /static/env.js {
110+
aio threads;
111+
add_header Cache-Control "no-cache";
112+
}
113+
}
114+
115+
}

werf.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
configVersion: 1
2+
project: "web-client"
3+
---
4+
image: builder
5+
from: node:16-alpine
6+
git:
7+
- add: /
8+
to: /app
9+
stageDependencies:
10+
install:
11+
- package.json
12+
- package-lock.json
13+
setup:
14+
- "**/*"
15+
shell:
16+
install:
17+
- cd /app
18+
#- yarn autoclean --init
19+
#- yarn autoclean --force
20+
- npm install
21+
setup: # Для стадии Setup.
22+
- cd /app
23+
- npm run build
24+
25+
---
26+
image: web
27+
from: nginx:alpine
28+
git:
29+
- add: /nginx.conf
30+
to: /etc/nginx/nginx.conf
31+
import:
32+
- image: builder
33+
add: /app/build
34+
to: /usr/share/nginx/html
35+
after: setup
36+

0 commit comments

Comments
 (0)