Giter VIP home page Giter VIP logo

s.blog's Introduction

s.blog

24.02.16 github action 따라하기

  • 로컬에서는 실행 확인

s.blog's People

Contributors

shimguh avatar

Watchers

 avatar

s.blog's Issues

github action 따라하기

요구사항
fly.io 에 배포한 도커 이미지가
1분 마다 git pull 을 수행해서
github 에 PUSH 하면 1분 안에 새로운 홈페이지가 반영 되도록

clontab

  • 프로그램을 예약 실행해야 하는 경우 crontab 사용할 수 있습니다.
  • 예를 들어 1시간 마다 특정 폴더를 백업하거나 Git 소스를 업데이트는 하는 자동화 작업을 진행하는 경우 crontab을 활용하면 됩니다.
  • crontab은 프로세스 예약 데몬이며, 리눅스용 작업 스케줄러로 특정 시각에 명령어를 수행하도록 등록 가능합니다.
- Crontab 규칙

* * * * *  유저 이름 명령어
┬ ┬ ┬ ┬ ┬
│ │ │ │ └─ 요일 (0 - 6) (0:일요일, 1:월요일, 2:화요일, …, 6:토요일)
│ │ │ └─ 월 (1 - 12)
│ │ └─일 (1 - 31)
│ └─ 시 (0 - 23)
└─ 분 (0 - 59)


- 예시 
   1. 매분, 매시간, 매일, 매월, 즉 1분만다 /home/ubuntu/start.sh 파일을 실행
       * * * * * root /home/ubuntu/start.sh

   2. 0분, 4시, 매일, 매월, 매일, 즉 매일 4시에 /home/ubuntu/start.sh 파일을 실행
       0 4 * * * root /home/ubuntu/start.sh

   3. 10분 간격, 4시, 매일, 매월, 매일, 즉 매일 4시, 4시 10분, 4시 20분, 4시 30분 /home/ubuntu/start.sh파일을 실행
       */10 4 * * * root /home/ubuntu/start.sh

  4. 6시간마다 /home/ubuntu/start.sh 파일을 실행
      0 */6 * * * root  /home/ubuntu/start.sh

   5. 평일(월요일~금요일) 08:00에 /home/ubuntu/start.sh 파일을 실행
       0 8 * * 1-5 root /home/ubuntu/start.sh
 
   6. 주말(일요일, 토요일) 08:00 에 /home/ubuntu/start.sh 파일을 실행
      0 8 * * 0,6 root /home/ubuntu/start.sh
   
   7. 매일 새벽 5시에 재부팅하기
      0 5 * * * root /sbin/shutdown -r now

fly

  1. branch 및 pr 생성 0.1.0/fly
  2. Dockerfile 생성
FROM node:20.11

WORKDIR /app

RUN npm install -g npm

RUN npm install -g json-server

COPY ./db.json /app

CMD ["json-server", "-p", "80", "-w", "/app/db.json"]
  1. https://fly.io/ 가입 - (주의! hobby plan 가입)
  2. 무료 플랜 : https://fly.io/docs/about/pricing/#free-allowances
  3. install cmd - https://fly.io/docs/hands-on/install-flyctl/
$ tail -n 3 ~/.zshrc
# fly
export FLYCTL_INSTALL="/home/<본인아이디>/.fly"
export PATH="$FLYCTL_INSTALL/bin:$PATH"

$ source ~/.zshrc
  1. flyctl auth login
$ flyctl launch
? Do you want to tweak these settings before proceeding? Yes
VM 1GB ->  256MB

port 설정

$ cat fly.toml
cat fly.toml
# fly.toml app configuration file generated for s-blog on 2024-02-15T13:39:44+09:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 's-blog'
primary_region = 'nrt'

[build]

[http_service]
  internal_port = 80
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[vm]]
  size = 'shared-cpu-1x'
$ flyctl deploy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.