Skip to content

Commit

Permalink
Merge pull request #26 from illacloud/CI/update_host
Browse files Browse the repository at this point in the history
ci: change host
  • Loading branch information
AruSeito authored Jan 3, 2024
2 parents 797c0da + 31ec7ad commit 8387487
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 120 deletions.
62 changes: 46 additions & 16 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ on:
push:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
- beta
- develop

permissions:
contents: write

env:
DO_CLUSTER: ${{ secrets.DO_CLUSTER }}
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_PWD: ${{ secrets.DOCKER_PWD }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_BOT_TOKEN }}

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
environment:
name:
${{ (github.ref == 'refs/heads/main') && 'production' || (github.ref ==
'refs/heads/develop') && 'test' || (github.ref == 'refs/heads/beta') &&
'beta' }}
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -49,18 +57,40 @@ jobs:
- name: Build website
run: pnpm build

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
token: ${{ secrets.DO_TOKEN }}

- name: Install kubectl
run: |
sudo snap install kubectl --classic
- name: Setup kubectl
run: |
doctl kubernetes cluster kubeconfig save $DO_CLUSTER
kubectl version
- name: Build Docker
run: |
docker build --cache-from=illa-website-frontend -f Dockerfile -t illa-website-frontend .
- name: Push application Docker image
run: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PWD
docker tag illa-website-frontend "illasoft/illa-website-frontend:$GITHUB_REF_NAME"
docker push "illasoft/illa-website-frontend:$GITHUB_REF_NAME"
- uses: actions/checkout@v4
with:
repository: illacloud/k8s-application-do
token: ${{ secrets.ILLA_BOT_TOKEN }}
path: k8s-application-do

- name: Deploy to Kubernetes
run: |
cd k8s-application-do/namespace-$ILLA_APP_ENV
kubectl apply -f ./illa-website-frontend/ -n $ILLA_APP_ENV
kubectl rollout restart deployment illa-website-frontend -n $ILLA_APP_ENV
5 changes: 0 additions & 5 deletions .idea/.gitignore

This file was deleted.

59 changes: 0 additions & 59 deletions .idea/codeStyles/Project.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/illa-website.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM nginx:stable-alpine as runner

## copy frontend
COPY nginx.conf /etc/nginx/nginx.conf
COPY illa-website-frontend.conf /etc/nginx/conf.d/illa-website-frontend.conf
COPY ./build /opt/illa/illa-website-frontend
RUN rm /etc/nginx/conf.d/default.conf

# test nginx
RUN nginx -t

# run
EXPOSE 3000
9 changes: 2 additions & 7 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ const config: Config = {
favicon: "img/public/favicon.ico",

// Set the production url of your site here
url: "https://illacloud.github.io",
url: "https://illa.cloud",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/illa-website/",
baseUrl: "/",
staticDirectories: ["public", "static"],

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "illacloud", // Usually your GitHub org/user name.
projectName: "illa-website", // Usually your repo name.

onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",

Expand Down
19 changes: 19 additions & 0 deletions illa-website-frontend.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
listen 80;
server_name localhost;
access_log /dev/stdout;
error_log /dev/stderr;
root /opt/illa/illa-website-frontend/;
index index.html;
gzip on;

sub_filter_once off;
location / {
try_files $uri $uri/ /index.html;
expires -1;
}

location /assets {
expires 1y;
}
}
38 changes: 38 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '"$time_local" client=$remote_addr '
'method=$request_method request="$request" '
'request_length=$request_length '
'status=$status bytes_sent=$bytes_sent '
'body_bytes_sent=$body_bytes_sent '
'referer=$http_referer '
'http_x_forwarded_for=$http_x_forwarded_for '
'user_agent="$http_user_agent" '
'upstream_addr=$upstream_addr '
'upstream_status=$upstream_status '
'request_time=$request_time '
'upstream_response_time=$upstream_response_time '
'upstream_connect_time=$upstream_connect_time '
'upstream_header_time=$upstream_header_time';

access_log /var/log/nginx/access.log main;

sendfile on;

keepalive_timeout 65;

include /etc/nginx/conf.d/*.conf;
}
4 changes: 2 additions & 2 deletions static/robots.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
User-agent: *
Host: https://illacloud.github.io/illa-website/
Sitemap: https://illacloud.github.io/illa-website/sitemap.xml
Host: https://illa.cloud
Sitemap: https://illa.cloud/sitemap.xml
Disallow: https://cloud.illacloud.com/*
Disallow: https://builder.illacloud.com/*
Disallow: https://status.illacloud.com/
Expand Down

0 comments on commit 8387487

Please sign in to comment.