Skip to content

Commit

Permalink
Added ci (#8)
Browse files Browse the repository at this point in the history
* Added files for ci

* Update actions.yaml

* Modify files for ci

* Update actions.yaml
  • Loading branch information
alexvarko authored Nov 1, 2023
1 parent 7a6bf6c commit d077133
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
branches:
- 'dev'

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_SHA
- name: Run Build
run: |
. $(werf ci-env github --as-file)
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
# stage-deploy:
# name: Deploy on stage
# needs: converge
# runs-on: ubuntu-latest
# steps:
# - name: ConfigCreate
# run: |
# mkdir ~/.kube/
# echo "${{ secrets.KUBECONFIG }}" > config
# mv config ~/.kube/
# ls ~/.kube/
# kubectl set image deployment/ -n stage
49 changes: 49 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_REF_NAME
- name: Run Build
run: |
. $(werf ci-env github --as-file)
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME --dev
# prod-deploy:
# name: Deploy on prod
# needs: converge
# runs-on: ubuntu-latest
# steps:
# - name: Run echo
# run: |
# echo "Tag was created - deploying on prod"
# echo tag = $GITHUB_REF_NAME
# - name: ConfigCreate
# run: |
# mkdir ~/.kube/
# echo "${{ secrets.KUBECONFIG }}" > config
# mv config ~/.kube/
# ls ~/.kube/
# kubectl set image deployment/ -n prod
115 changes: 115 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes auto; #some last versions calculate it automatically

# number of file descriptors used for nginx
# the limit for the maximum FDs on the server is usually set by the OS.
# if you don't set FD's then OS settings will be used which is by default 2000
worker_rlimit_nofile 100000;

# only log critical errors
error_log /var/log/nginx/error.log crit;

# provides the configuration file context in which the directives that affect connection processing are specified.
events {
# determines how much clients will be served per worker
# max clients = worker_connections * worker_processes
# max clients is also limited by the number of socket connections available on the system (~64k)
worker_connections 4000;

# optimized to serve many clients with each thread, essential for linux -- for testing environment
use epoll;

# accept as many connections as possible, may flood worker connections if set too low -- for testing environment
multi_accept on;
}

http {
# Temporary directories for kubernetes "readonlyfilesystem"
client_body_temp_path /tmp/nginx-client-body;
proxy_temp_path /tmp/nginx-proxy;
fastcgi_temp_path /tmp/nginx-fastcgi;
uwsgi_temp_path /tmp/nginx-uwsgi;
scgi_temp_path /tmp/nginx-scgi;
# cache informations about FDs, frequently accessed files
# can boost performance, but you need to test those values
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

# to boost I/O on HDD we can disable access logs
access_log off;

# copies data between one FD and other from within the kernel
# faster than read() + write()
sendfile on;

# send headers in one piece, it is better than sending them one by one
tcp_nopush on;

# don't buffer data sent, good for small data bursts in real time
tcp_nodelay on;

# reduce the data that needs to be sent over network -- for testing environment
gzip on;
# gzip_static on;
gzip_min_length 10240;
gzip_comp_level 1;
gzip_vary on;
gzip_disable msie6;
gzip_proxied expired no-cache no-store private auth;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
application/atom+xml
font/truetype
font/opentype
application/vnd.ms-fontobject
image/svg+xml;

# allow the server to close connection on non responding client, this will free up memory
reset_timedout_connection on;

# request timed out -- default 60
client_body_timeout 10;

# if client stop responding, free up memory -- default 60
send_timeout 2;

# server will close connection after this time -- default 75
keepalive_timeout 30;

# number of requests client can make over keep-alive -- for testing environment
keepalive_requests 100000;

include /etc/nginx/mime.types;

server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html index.htm;
server_name _;
location / {
aio threads;
try_files $uri /index.html;
}
location /env.js {
aio threads;
add_header Cache-Control "no-cache";
}
location /static/env.js {
aio threads;
add_header Cache-Control "no-cache";
}
}

}
36 changes: 36 additions & 0 deletions werf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
configVersion: 1
project: "web-client"
---
image: builder
from: node:16-alpine
git:
- add: /
to: /app
stageDependencies:
install:
- package.json
- package-lock.json
setup:
- "**/*"
shell:
install:
- cd /app
#- yarn autoclean --init
#- yarn autoclean --force
- npm install
setup: # Для стадии Setup.
- cd /app
- npm run build

---
image: web
from: nginx:alpine
git:
- add: /nginx.conf
to: /etc/nginx/nginx.conf
import:
- image: builder
add: /app/build
to: /usr/share/nginx/html
after: setup

0 comments on commit d077133

Please sign in to comment.