블로그 이미지
Flying Mr.Cheon youGom

Recent Comment»

Recent Post»

Recent Trackback»

« 2025/12 »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

 
 

Docker Configuration

서버/Infra | 2023. 5. 11. 17:04 | Posted by youGom

It is not typing any korean might be in ubuntu of the language problem on utf8.
This is contents only my log how to get checking docker default.
It's terrible to set the python version virutal environment up. this docker system would rather that?

This is default configuration method and summary; Docker Configurations

* Below links are almost entry point: https://docs.docker.com/language/python/build-images/

Contents.
1. Install Docker
    - The docker document site shows to install the docker-gui at first, but it should install the docker-cli in middle contents;
    ( docker-install[gui] - link , docker-cert[ca] - link , docker-install[cli] - link )
2. Docker run: image 'hello world'
    - It is very simple command like 'docker run docker-hello' for getting check or verify the docker-package.
3. Docker Image Pull: Python3.6 slim buster - (list)link
    - The docker document shows python 3.8, but trying to version of 3.6; python 3.6 image link
4. Docker Image Control: Flask 'hello world'
    - Build, Tag - link
    - Run, Stop, Remove, View List - link
    - Finally command: docker run -d -p 8000:5000 --name rest-server python_image
5. Docker Image Control: Mysql 'hello world', link
    - To meet some error; mysql-connector (had been installed by pip3 (python3.6))
    - To reset python version to 3.8 from 3.6, and to restart generating from 'python3 -m venv .venv' for the first time.
    - Getting Experience; docker network, volume and compose by yaml file; docker-compose.dev.yml
6. CI/CD: GitHub actions - link
    - Create workflow yaml file
7. Deploy: Azure, ECS, EKS - link
    - It would refer any page to be meet a environment of the infras, or the IaaS provider would provide us more information.

 

Notes.
1. Hope to use the docker command line without 'sudo ...' like 'sudo docker ...'
   $ sudo usermod -aG docker $USER
   - To run docker command without 'sudo' after logout, or 'sudo su -l $USER'

'서버 > Infra' 카테고리의 다른 글

[Infra] LoadBalancer Haproxy Install  (0) 2018.03.20
:

couchdb basic tutorial

서버/Python | 2020. 4. 26. 16:42 | Posted by youGom

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

import couchdb

Connection

If you only need read access, use an anonymous connection:

couchserver = couchdb.Server("http://couchdb:5984/")

To write to the database, create an authenticated connection:

user = "admin"
password = "my secret password"
couchserver = couchdb.Server("http://%s:%s@couchdb:5984/" % (user, password))

Listing databases

Simply iterate over the server object like this:

for dbname in couchserver:
    print(dbname)

Selecting/creating a database to work with

dbname = "mydb"
if dbname in couchserver:
    db = couchserver[dbname]
else:
    db = couchserver.create(dbname)

Deleting a database

del couchserver[dbname]

Writing a document to a database

Storing a document with an auto-generated ID:

doc_id, doc_rev = db.save({'key': 'value'})

doc_id is the generated document ID, doc_rev is the revision identifier.

Setting a specific ID:

db["my_document_id"] = {'key': 'value'}

Writing multiple documents in one call is done via the update() method of the database object. This can either create new documents (when no _id field is present per document) or update existing ones.

docs = [{'key': 'value1'}, {'key': 'value2'}]
for (success, doc_id, revision_or_exception) in db.update(docs):
    print(success, docid, revision_or_exception)

Retrieving documents by ID

doc_id = "my_document_id"
doc = db[doc_id]  # or db.get(doc_id)

Querying documents from views

If your database has a design document and view under the path /db_name/_design/design_doc/_view/view_name, you can iterate this view using this syntax:

for item in db.view('design_doc/view_name'):
    print(item.key, item.id, item.value)

Limiting the output to a certain number of items:

for item in db.view('design_doc/view_name', limit=100):
    print(item.key, item.id, item.value)

Skipping the first n items:

for item in db.view('design_doc/view_name', skip=100):
    print(item.key, item.id, item.value)

Reverse sorting:

for item in db.view('design_doc/view_name', descending=True):
    print(item.key, item.id, item.value)

Including source documents in result entries:

for item in db.view('design_doc/view_name', include_docs=True):
    print(item.key, item.id, item.value)

Allow outdated data to be returned, prevent updating the view before returning results:

for item in db.view('design_doc/view_name', stale="ok"):
    print(item.key, item.id, item.value)

Update the view after returning the results:

for item in db.view('design_doc/view_name', stale="update_after"):
    print(item.key, item.id, item.value)

Grouping results

Grouping the results by key, using the Reduce function, must be activated explicitly:

for item in db.view('design_doc/view_name', group=True):
    print(item.key, item.value)

If the Map function emits a structured key (an array with multiple elements), the grouping level can be determined:

for item in db.view('design_doc/view_name', group=True, group_level=1):
    print(item.key, item.value)

Filtering

Return only entries from the view matching a certain key:

for item in db.view('design_doc/view_name', key="my_key"):
    print(item.key, item.id, item.value)

Return entries with keys in a certain range:

for item in db.view('design_doc/view_name', startkey="startkey", endkey="endkey"):
    print(item.key, item.id, item.value)

The key, startkey and endkey parameters also accept arrays, e. g.

for item in db.view('design_doc/view_name', startkey=["foo", "a"], endkey=["foo", "z"]):
    print(item.key, item.id, item.value)

 

 

출처 : https://gist.github.com/marians/8e41fc817f04de7c4a70

:

[Security] Fillder Menual / UseCase

보안/도구 | 2014. 2. 27. 10:28 | Posted by youGom

Fiddler는 개인PC의 웹브라우저와 Internet 사이에서 발생하는 모든 HTTP 트래픽을 로깅하는 HTTP Debugging Proxy이다. 사용법은 간단하다. Fiddler를 실행하고 브라우저에서 해당 URL을 열면 트래픽 정보를 보여준다.
이때 빨간아이콘이 보이면 클릭하면 상세 지연시간등을 확인할 수 있다.

- jamesku - 

다운로드 사이트 
http://www.fiddler2.com/fiddler2/

현재 페이지에서 다운로드 ->   Fiddler2Setup.zip

 



1. What is Fiddler?

웹 디버깅 프록시는 귀하의 컴퓨터와 인터넷 사이의 트래픽을 모든 HTTP (S)를 기록합니다설정 중단점 및 들어오는 또는 나가는 데이터를 캡쳐스크립팅 서브 시스템 기반그리고 . NET의 언어 트래픽 모든 HTTP(S)를 열람 할 수 있습니다.

또한 FreeWare 이며 다양한 프로그램으로부터 트래픽 디버깅을 할 수 있으며 Internet Explorer, Mozilla Firefox, Opera 등에 사용할 수 있습니다.

아래는 원문이다.

 Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and "fiddle" withincoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Fiddler is freeware and can debug traffic from virtually any application, including Internet

Explorer, Mozilla Firefox, Opera, and thousands more.


 

2. Fiddler의 작동 방식




3. HTTPS Traffic Description

-  HTTP 요청에 의한 HTTP Session List   를 볼수있습니다.

- Fiddler를 켜 놓는것만으로도 HTTP Session 을 실시간으로 가져올수있습니다.
-우측 Tab들을 이용 Session값에 대한 정보 들을 알수있습니다.





4. Fiddler UI : Session List


#          해당하는 URL의 아이콘을 표시합니다) URL:/flash/03.swf =>Flash 파일 표시

Result    : Session의 고유아이디

Protocol : Session을 주고 받는 방식

Host      값이 출발하는 장소

URL        주소입니다.

Body      전송량

Content-Type : 컨텐츠의 종류를 나타냄  문서웹페이지,프로그램….

Process  : Session을 이용하고있는 프로그램과 프로그램아이디(PID)를 표시



5. Fiddler UI : Inspectors

 

 Ajax관련 기능을 디버깅 할때 제일 많이 사용하는 기능입니다.

세션리스트에서 세션을 선택하면 해당 세션에 대한 정보를 보여줍니다.

해당 세션의 request의 다양한 정보와 response의 정보 그리고 response의 내용도 볼 수 있습니다.

추가적으로 페이지를 수정 할 수 있는 기능이 있습니다.



6. Fiddler Script Rules


 자바 스크립트를 사용하여 요청이나 응답, 헤더 또는 entity 본문 조작을 할 수 있습니다


7. Extending Fiddler UI


  Fiddler Scripts와 확장된 메뉴와 Tab을 이용하여 세밀한 작업이 가능하다.



8. Using Simple Filters


  Fiddler에서 지원하는 다양한 필터 기능을 사용하여 자신이 원하는 값을 손쉽게 찾아 낼수 있습니다.


9. Auto Responder


 Session List 를 선택하여 AutoResponder란에 추가할수 있으며 그 값을 생성  생성 이전의 트래픽을 캡처할수 있습니다.



10. Fiddler 활용의 예 I - 다운로드 지연시간 시뮬레이션

oSession["request-trickle-delay"] = "300"; 

oSession["response-trickle-delay"] = "150"; 

부분 수정 .


Rules > Performance > Simulate Modem Speeds 를 선택했을때 해당값 적용.


11. Fiddler 활용의 예 II - Flex나 Flash활용


 Flex(air)나 Flash에서의 활용 

Flex나 Flash의 결과물은 SWF로써 대부분 사용자 PC 에서 다운로드 후에 플레이(실행)되는 특성을 가진다여기서 주목해야 할 부분이 SWF가 만약에 호스트(이하 서버)와 클라이언트 관계를 가지며 서로 통신해야 할 경우를 생각하여 보자.  특히 개발중의 상태라 한다면 무리 없이 서버와 SWF간 통신을 직간접적으로 디버깅하며 모니터링 할 수 있다.

반면 서비스 개발이 끝나는 시점이를테면 실 서버에 배포가 된 상황이며현재 SWF가 정상적으로 작동하지 않는다고 가정하여 보자. 2가지 상황을 가정할 수 있는데 하나는 기능상의 버그를또 다른 하나는 네트워크 데이터 통신의 장애(에러)를 들 수 있다.

 

우리 개발자에게 있어 문제를 해결하는데 가장 빠른 방법은 똑같은 장애 사항을 수동으로 개발자 본인이 직접 재연할 수 있다면 99% 해결 된다고 볼 수 있다문제의 원인을 확실하게 알고 있다는 극명한 증거이기 때문이다여기서 SWF와 서버간 네트워크 장애를 판별 할 수 있게 하는  가장 손쉬운 방법이 네트워크 디버거를 이용하여 HTTP, HTTPS,SOAP, Socket에서 들어오고 나가는 데이터를

살펴 봄으로써 장애의 원인을 분석할 수 있다.

'보안 > 도구' 카테고리의 다른 글

공유 게시판 이더패드  (0) 2015.03.30
[NMAP] MS-SQL pentest  (0) 2014.11.17
unix util commands  (0) 2013.12.10
putty connection manager  (0) 2013.10.07
FTK Imager  (0) 2013.09.13
:

[CouchDB] CouchDB on NodeJS, cradle

서버/BigDB | 2013. 10. 27. 17:10 | Posted by youGom



CouchDB 사용할 수 있도록 기본 정보가 제공되어 있음.


출처 : https://github.com/cloudhead/cradle


기본 튜토리얼 내용



'서버 > BigDB' 카테고리의 다른 글

[CouchDB] ruby에서 couchdb 잘 사용하기  (0) 2013.10.28
[CouchDB] 5984 port open, access couchdb  (0) 2013.10.27
[CouchDB] Map/Reduce 개념잡기  (0) 2013.10.25
:

1.2.4 HTML5 Canvas Line Cap Tutorial

프로그래밍/HTML5 | 2012. 1. 9. 10:34 | Posted by youGom

http://www.html5canvastutorials.com/tutorials/html5-canvas-line-caps/

html5 canvas line에 cap을 추가 할 수 있다.
cap은 다음 셋중 하나를 선택할 수 있다; butt, round, square.

context.lineCap=[value];


아래 링크로 예제를 확인 할 수 있다.
http://www.html5canvastutorials.com/demos/tutorials/html5_canvas_line_caps/


window.onload = function(){
    var canvas = document.getElementById("myCanvas");
    var context = canvas.getContext("2d");
 
    // butt line cap (top line)
    context.beginPath();
    context.moveTo(200, canvas.height / 2 - 50);
    context.lineTo(canvas.width - 200, canvas.height / 2 - 50);
    context.lineWidth = 20;
    context.strokeStyle = "#0000ff"; // line color
    context.lineCap = "butt";
    context.stroke();
 
    // round line cap (middle line)
    context.beginPath();
    context.moveTo(200, canvas.height / 2);
    context.lineTo(canvas.width - 200, canvas.height / 2);
    context.lineWidth = 20;
    context.strokeStyle = "#0000ff"; // line color
    context.lineCap = "round";
    context.stroke();
 
    // square line cap (bottom line)
    context.beginPath();
    context.moveTo(200, canvas.height / 2 + 50);
    context.lineTo(canvas.width - 200, canvas.height / 2 + 50);
    context.lineWidth = 20;
    context.strokeStyle = "#0000ff"; // line color
    context.lineCap = "square";
    context.stroke();
};




 

:

1.2.3 HTML5 Canvas Line Color Tutorial

프로그래밍/HTML5 | 2012. 1. 9. 10:30 | Posted by youGom

http://www.html5canvastutorials.com/tutorials/html5-canvas-line-color/

html5 canvas line은 컬러를 설정할 수 있다.

context.strokeStyle=[value];

아래 창을 열어 예제를 확인 할 수 있다.
http://www.html5canvastutorials.com/demos/tutorials/html5_canvas_line_color/


window.onload = function(){
    var canvas = document.getElementById("myCanvas");
    var context = canvas.getContext("2d");
 
    context.moveTo(100, 150);
    context.lineTo(450, 50);
    context.lineWidth = 10;
    context.strokeStyle = "#ff0000"; // line color
    context.stroke();
};
:

html5 canvas 선의 굵기를 정의 할 수 있다.
context.lineWidth=[value];

아래 주소를 클릭하면 예제가 보인다.
http://www.html5canvastutorials.com/demos/tutorials/html5_canvas_line_width/

window.onload = function(){
    var canvas = document.getElementById("myCanvas");
    var context = canvas.getContext("2d");
 
    context.moveTo(100, 150);
    context.lineTo(450, 50);
    context.lineWidth = 15;
    context.stroke();
};



'프로그래밍 > HTML5' 카테고리의 다른 글

1.2.4 HTML5 Canvas Line Cap Tutorial  (0) 2012.01.09
1.2.3 HTML5 Canvas Line Color Tutorial  (0) 2012.01.09
1.2.1 HTML5 Canvas Line Tutorial  (0) 2012.01.09
1.1.1 HTML5 Canvas Element Tutorial  (0) 2012.01.09
HTML5, JS, Javascript, canvas  (0) 2012.01.09
: