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
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'
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)
Fiddler는 개인PC의 웹브라우저와 Internet 사이에서 발생하는 모든 HTTP 트래픽을 로깅하는 HTTP Debugging Proxy이다. 사용법은 간단하다. Fiddler를 실행하고 브라우저에서 해당 URL을 열면 트래픽 정보를 보여준다. 이때 빨간아이콘이 보이면 클릭하면 상세 지연시간등을 확인할 수 있다.
웹 디버깅 프록시는 귀하의 컴퓨터와 인터넷 사이의 트래픽을 모든 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에서 들어오고 나가는 데이터를
Cradle's API builds right on top of Node's asynch API. Every asynch method takes a callback as its last argument. The return value is an event.EventEmitter, so listeners can also be optionally added.
You can check if a database exists with the exists() method.
db.exists(function(err,exists){if(err){console.log('error',err);}elseif(exists){console.log('the force is with you.');}else{console.log('database does not exists.');db.create();/* populate design documents */}});
If you want to get a specific revision for that document, you can pass it as the 2nd parameter to get().
Cradle is also able to fetch multiple documents if you have a list of ids, just pass an array to get:
db.get(['luke','vader'],function(err,doc){...});
Querying a view
db.view('characters/all',function(err,res){res.forEach(function(row){console.log("%s is on the %s side of the force.",row.name,row.force);});});
You can access the key and value of the response with forEach using two parameters. An optional third parameter will return the id like this example.
db.view('characters/all',function(err,res){res.forEach(function(key,row,id){console.log("%s has view key %s.",row.name,key);});});
To use View Generation Options you can use the view Method with three parameters (viewname, options, callback):
db.view('characters/all',{group:true,reduce:true},function(err,res){res.forEach(function(row){console.log("%s is on the %s side of the force.",row.name,row.force);});});
Querying a row with a specific key
Lets suppose that you have a design document that you've created:
If you want all the cars made by Ford with a model name between Rav4 and later (alphabetically sorted). In CouchDB you could query this view directly by making an HTTP request to:
In the options object you can also optionally specify whether or not to group and reduce the output. In this example reduce must be false since there is no reduce function defined for the cars/byMakeAndModel. With grouping and reducing the options object would look like:
Note that when saving a document this way, CouchDB overwrites the existing document with the new one. If you want to update only certain fields of the document, you have to fetch it first (with get), make your changes, then resave the modified document with the above method.
If you only want to update one or more attributes, and leave the others untouched, you can use the merge()method:
db.merge('luke',{jedi:true},function(err,res){// Luke is now a jedi,// but remains on the dark side of the force.});
Note that we didn't pass a _rev, this only works because we previously saved a full version of 'luke', and thecache option is enabled.
bulk insertion
If you want to insert more than one document at a time, for performance reasons, you can pass an array tosave():
Note: If you must use View Generation Options on your temporary view you can use the three parameter version of the temporaryView() Method - similar to the one described above.
creating validation
when saving a design document, cradle guesses you want to create a view, mention views explicitly to work around this.
db.save('_design/laws',{views:{},validate_doc_update:function(newDoc,oldDoc,usrCtx){if(!/^(light|dark|neutral)$/.test(newDoc.force))throw{error:"invalid value",reason:"force must be dark, light, or neutral"}}}});
removing documents (DELETE)
To remove a document, you call the remove() method, passing the latest document revision.
If remove is called without a revision, and the document was recently fetched from the database, it will attempt to use the cached document's revision, providing caching is enabled.
Or if you want to see changes since a specific sequence number:
db.changes({since:42},function(err,list){...});
The callback will receive the list of changes as an Array. If you want to include the affected documents, simply pass include_docs: true in the options.
Streaming
You can also stream changes, by calling db.changes without the callback. This API uses the excellentfollowlibrary from IrisCouch:
In this case, it returns an instance of follow.Feed, which behaves very similarly to node's EventEmitterAPI. For full documentation on the options available to you when monitoring CouchDB with .changes() see the follow documentation.
Attachments
Cradle supports writing, reading, and removing attachments. The read and write operations can be either buffered or streaming
Writing
You can buffer the entire attachment body and send it all at once as a single request. The callback function will fire after the attachment upload is complete or an error occurs
You can use a read stream to upload the attachment body rather than buffering the entire body first. The callback function will fire after the streaming upload completes or an error occurs
Syntax
vardoc=savedDoc// <some saved couchdb document which has an attachment>varid=doc._idvarrev=doc._revvaridAndRevData={id:id,rev:rev}varattachmentData={name:attachmentName// something like 'foo.txt''Content-Type':attachmentMimeType// something like 'text/plain', 'application/pdf', etc.body:rawAttachmentBody// something like 'foo document body text'}varreadStream=fs.createReadStream('/path/to/file/')varwriteStream=db.saveAttachment(idData,attachmentData,callbackFunction)readStream.pipe(writeStream)
When the streaming upload is complete the callback function will fire
Example Attach a pdf file with the name 'bar.pdf' located at path './data/bar.pdf' to an existing document
varpath=require('path')varfs=require('fs')// this document should already be saved in the couchdb databasevardoc={_id:'fooDocumentID',_rev:'fooDocumentRev'}varidData={id:doc._id,rev:doc._rev}varfilename='bar.pdf'// this is the filename that will be used in couchdb. It can be different from your source filename if desiredvarfilePath=path.join(__dirname,'data','bar.pdf')varreadStream=fs.createReadStream// note that there is no body field here since we are streaming the uploadvarattachmentData={name:'fooAttachment.txt','Content-Type':'text/plain'}db.saveAttachment(idData,attachmentData,function(err,reply){if(err){console.dir(err)return}console.dir(reply)},readStream)
Reading
Buffered
You can buffer the entire attachment and receive it all at once. The callback function will fire after the download is complete or an error occurs. The second parameter in the callback will be the binary data of the attachment
You can stream the attachment as well. If the attachment is large it can be useful to stream it to limit memory consumption. The callback function will fire once the download stream is complete. Note that there is only a single error parameter passed to the callback function. The error is null is no errors occured or an error object if there was an error downloading the attachment. There is no second parameter containing the attachment data like in the buffered read example
Example Say you want to read back an attachment that was saved with the name 'foo.txt'. However the attachment foo.txt is very large so you want to stream it to disk rather than buffer the entire file into memory
vardoc=<somesaveddocumentthathasanattachmentwithname*foo.txt*>varid=doc._idvarattachmentName='foo.txt'vardownloadPath=path.join(__dirname,'foo_download.txt')varwriteStream=fs.createWriteStream(downloadPath)varreadStream=db.getAttachment('piped-attachment','foo.txt',function(err){// note no second reply paramterif(err){console.dir(err)return}console.dir('download completed and written to file on disk at path',downloadPath)})readStream.pipe(writeStream)
Removing
You can remove uploaded attachments with a _id and an attachment name
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();};