-
Notifications
You must be signed in to change notification settings - Fork 0
Description
좋았던 것(Liked)
- 없음
배운 것(Learned)
파일 배포 순서
파일 설치
$ pip install [패키지명]
DEV
※ 배포 파일 없을 시 레파지토리 생성
$ git clone [레파지토리 위치]
$ cd hello-doxg
$ pdm venv create
$ source .venv/bin/activate
(hello-doxg-3.8) $ pdm install
Test파일 생성
$ pdm add -dG test pytest pytest-cov
DEPLOY
$ pdm publish
Contributing
① 브랜치 생성
$ git branch 0.2.0/doxg
② 브랜치 변경
$ git checkout 0.2.0/doxg
③ 파일 변경 및 추가 생성
④ git 상태 확인
$ git status
On branch 0.2.0/doxg
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: [변경된 파일 리스트]
[생성된 파일 리스트]
no changes added to commit (use "git add" and/or "git commit -a")
⑤ 현재 폴더 내 파일 전부 등록
$ git add .
⑥ 현재 까지 내용 기록하기
$ git commit -m "start dev 0.2.0"
[0.2.0/doxg 4ed0751] start dev 0.2.0
1 file changed, 1 insertion(+), 1 deletion(-)
⑦ git 푸쉬하기
$ git push
fatal: The current branch 0.2.0/doxg has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin 0.2.0/doxg
$ git push --set-upstream origin 0.2.0/doxg
홈페이지 배포 순서
1. Local - 내 소스 github 생성 테스트 -> 브랜치 생성
① Repository name : username.github.io 의 형식으로 만들것
② git clone username.github.io > 우분투에 github 가져오기
③ index.html 파일 생성
④ 원격 장소로 푸쉬하기
git add .
git cmmit -m "Start git BlogSite"
git push
⑤ git hub에 접속하기 https://felicette1963.github.io/
2. DEV - firebase https://felicette1963-3a994.web.app/
dj-twenty-six/dj-twenty-six.github.io#4 참조 사이트
① https://console.firebase.google.com/ 회원가입
② <script> 태그 사용
※ Node.js 16버전 이상 설치 할것
https://github.com/nodesource/distributions Node js 설치
Node js 설치를 위한 Nodesource GPG key 다운로드
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
레포지토리 만들기
[version]
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
버전
NODE_MAJOR=16 NODE_MAJOR=18 NODE_MAJOR=20 NODE_MAJOR=21
Nodejs 설치
sudo apt-get update
sudo apt-get install nodejs -y
Nodejs 설치 완료
③ npm install -g firebase-tools
④ cd [배포파일 위치]
⑤ firebase login
⑥ firebase init

⑦ firebase deplot

⑧ 결과 확인 https://felicette1963-3a994.web.app/
⑨ 일련의 과정을 branch를 생성하여 git push 하기
3. STD - fly.io
https://github.com/dj-twenty-six/dj-twenty-six.github.io/tree/1.2.0/deploy-fly.io 참조사이트
① fly.io 회원 가입
② Docker File 설치 https://hub.docker.com/_/httpd
배포 파일의 위치에서 아래와 같은 Dockerfile 생성
FROM httpd:2.4
COPY . /usr/local/apache2/htdocs/
③ apache 도커 생성
$ docker build -t [도커명] .
$ docker run -dit --name [컨테이너명] -p 8080:80 [도커명]
※ 도커 확인
sudo docker exec -it [컨테이너명] bash
④ flyctl 셋팅
- 설치
$ curl -L https://fly.io/install.sh | sh
- 셋팅
$ tail -n 3 ~/.zshrc
# fly.io
export FLYCTL_INSTALL="/home/dj26/.fly"
export PATH="$FLYCTL_INSTALL/bin:$PATH"
⑤ cd [도커 파일이 있는 곳]
⑥ flyctl auth login
⑦ flyctl launch
$ flyctl launch
Creating app in /home/dj26/code/dj-twenty-six.github.io
Scanning source code
Detected a Dockerfile app
? Choose an app name (leave blank to generate one): dj-twenty-six
automatically selected personal organization: data.mario24@gmail.com
Some regions require a paid plan (bom, fra, maa).
See https://fly.io/plans to set up a plan.
? Choose a region for deployment: Tokyo, Japan (nrt)
App will use 'nrt' region as primary
Created app 'dj-twenty-six' in organization 'personal'
Admin URL: https://fly.io/apps/dj-twenty-six
Hostname: dj-twenty-six.fly.dev
? Would you like to set up a Postgresql database now? No
? Would you like to set up an Upstash Redis database now? No
? Create .dockerignore from 1 .gitignore files? No
Wrote config file fly.toml
? Would you like to deploy now? No
Validating /home/dj26/code/dj-twenty-six.github.io/fly.toml
Platform: machines
✓ Configuration is valid
Your app is ready! Deploy with `flyctl deploy`
$ tail -n 13 fly.toml
app = "dj-twenty-six"
primary_region = "nrt"
[build]
dockerfile = "Dockerfile"
[http_service]
internal_port = 80
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 3
processes = ["app"]
⑧ fly deploy
https://felicette1963.fly.dev/ 생성
⑨ 일련의 과정을 branch를 생성하여 git push 하기
4. PRD - git merge [메인]
5. docker hub에 등록
① docker login
② docker build
docker build -t felicette1963/felicette1963.github.io:1.0.0 .
[+] Building 0.4s (7/7) FINISHED docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 86B 0.0s
=> [internal] load metadata for docker.io/library/httpd:2.4 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 22.57kB 0.0s
=> CACHED [1/2] FROM docker.io/library/httpd:2.4 0.0s
=> [2/2] COPY . /usr/local/apache2/htdocs/ 0.2s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:235219413a6b5590c737feff4e9c4448484aa79fbb086126 0.0s
=> => naming to docker.io/felicette1963/felicette1963.github.io:1.0.0 0.0s
③ docker push
$ docker push felicette1963/felicette1963.github.io:1.0.0
The push refers to repository [docker.io/felicette1963/felicette1963.github.io]
1c9b2bbf7100: Pushed
b7094d4685d5: Mounted from library/httpd
87ca57c6f4e9: Mounted from library/httpd
1343ea427053: Mounted from library/httpd
8db3e477577e: Mounted from library/httpd
cb4596cc1454: Mounted from library/httpd
1.0.0: digest: sha256:034b41fb05515d61cb4f2fdd42a177453d2e7f21aa74a903bed0dc05c900f8d5 size: 1577
⑤ 도커 이미지 위치 확인
felicette1963/felicette1963.github.io
로드 밸런서 설정
① 파일 수정
code .
② docker build
$ docker build -t felicette1963_blog:1.3.0 .
[+] Building 0.4s (7/7) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 86B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/httpd:2.4 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 13.24kB 0.0s
=> CACHED [1/2] FROM docker.io/library/httpd:2.4 0.0s
=> [2/2] COPY . /usr/local/apache2/htdocs/ 0.2s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:7e1287bc3914185852de96b11bba0c5232bf509f7b0b4995 0.0s
=> => naming to docker.io/library/felicette1963_blog:1.3.0 0.0s
③ docker run
$ docker run -dit --name felicette1963_blog-1 -p 8051:80 felicette1963_blog:1.3.0
$ docker run -dit --name felicette1963_blog-2 -p 8052:80 felicette1963_blog:1.3.0
④ docker nginx 파일 생성
$ docker build -t felicette1963_nginx_lb:1.3.0 docker_file/lb_nginx
⑤ docker nginx 파일 실행
docker run --name felicette1963_nginx_lb -d -p 9052:80 --link felicette1963_blog-1 --link felicette1963_blog-2 felicette1963_nginx_lb:1.3.0
⑥ 이미지 확인
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fada2177d0bf felicette1963_nginx_lb:1.3.0 "/docker-entrypoint.…" 7 seconds ago Up 6 seconds 0.0.0.0:9052->80/tcp felicette1963_nginx_lb
37128a6886cc felicette1963_blog:1.3.0 "httpd-foreground" 5 minutes ago Up 5 minutes 0.0.0.0:8052->80/tcp felicette1963_blog-2
ffc24656f919 felicette1963_blog:1.3.0 "httpd-foreground" 5 minutes ago Up 5 minutes 0.0.0.0:8051->80/tcp felicette1963_blog-1
$ docker iamges
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
felicette1963_nginx_lb 1.3.0 b80b3925f571 10 minutes ago 187MB
felicette1963_blog 1.3.0 7e1287bc3914 15 minutes ago 173MB
부족했던 것(Lacked)
- 없음
바라는 것(Longed for)
- 없음



