scrapy专题-scrapyd部署

2021年10月25日 07:22 by scott

数据抓取

问题和方案

Scrapyd是个不错的工具,能实现scrapy项目的远程执行。但是也有一些缺点:

1. 没有权限认证体系,暴露到公网不安全;

2. 自己无法后台运行;

针对这两个问题,通过探索和总结得到如下解决方案:

1. 通过nginx中添加auth_basic实现权限管理;

2. 通过supervisor实现scrapyd后台运行;

实现步骤

前提条件:

1. 已通过conda安装了虚拟环境,假定名字为crawl;

2. 已安装supervisor,默认安装的配置文件目录为/etc/supervisor;

3. 已安装nginx,默认安装的配置文件目录为/etc/nginx;

4. 已安装apache2-utils,安装命令为sudo apt install apache2-utils;

5. 已生成秘钥文件,生成命令为 cd /etc/nginx/conf.d && sudo htpasswd -c .htpasswd admin

具体步骤:

1. 配置supervisor,编写配置文件/etc/supervisor/conf.d/scrapyd.conf,内容如下:

[program:scrapyd]
directory=/home/ubuntu/workspace/
command=/home/ubuntu/.conda/envs/crawl/bin/scrapyd
autostart=true
autorestart=true
startsecs=5

stderr_logifle=/tmp/scrapyd_stderr.log
stdout_logfile=/tmp/scrapyd_stdout.log
redirect_stderr=true
stdout_logfile_maxbytes=20MB
stdout_logfile_backups=10

注意配置中的command,这里用的虚拟环境里安装scrapyd

2. 重新启动supervisor, 命令如下:

supervisorctl reload

3. 配置nginx,编写配置文件/etc/nginx/conf.d/scrapy.conf,内容如下:

server {
        listen 8600;
        access_log /home/ubuntu/workspace/logs/scrapyd_access.log;
        error_log /home/ubuntu/workspace/logs/scrapyd_error.log;  
        location / {
            proxy_pass    http://127.0.0.1:6800/;
            auth_basic    "Restricted";
            auth_basic_user_file    /etc/nginx/conf.d/.htpasswd;
        }
}

4. 重新载入nginx配置:

sudo nginx -s reload

总结

这里通过外部工具完美解决了scrapyd本身存在的问题,主要使用了nginx的转发和秘钥配置功能,以及supervisor监控并后台运行程序的功能。


Comments(124) Add Your Comment

Frvcym
lipitor 20mg uk <a href="https://lipiws.top/">where can i buy lipitor</a> order atorvastatin online cheap
Vgifqa
cipro 500mg pill - <a href="https://metroagyl.top/oxytetracycline/">buy ethambutol 600mg</a> augmentin over the counter
Jlcugi
buy ciprofloxacin 500mg pill - <a href="https://cipropro.top/bactrimos/">order bactrim 960mg online</a> purchase augmentin pill
Exgxdk
brand flagyl 200mg - <a href="https://metroagyl.top/keflexcapsule/">buy generic amoxicillin online</a> buy cheap azithromycin
Rtelzu
buy ciprofloxacin 500 mg without prescription - <a href="https://septrim.top/doryx/">cheap doryx pills</a> erythromycin 250mg generic
Jvfjuu
valacyclovir without prescription - <a href="https://gnantiviralp.com/nemasole/">cheap nemasole pill</a> buy acyclovir no prescription
Mflcto
buy ivermectin 6 mg online - <a href="https://keflexin.top/amoxiclav/">amoxiclav for sale online</a> sumycin 250mg uk
Zwhydc
metronidazole 400mg oral - <a href="https://metroagyl.top/azithromycin/">buy azithromycin generic</a> buy azithromycin 500mg without prescription
Dzwttm
buy generic ampicillin <a href="https://ampiacil.top/amoxil500/">buy cheap amoxil</a> buy generic amoxil online
Gdhgvw
buy lasix tablets - <a href="https://antipathogenc.com/capoten/">captopril 25 mg ca</a> capoten brand
Zsvrai
purchase metformin online - <a href="https://gnantiacidity.com/lincocin/">lincocin 500 mg generic</a> lincomycin 500mg pill
Pbzgyb
retrovir medication - <a href="https://canadiangnp.com/avapro/">avalide cost</a> allopurinol 100mg cost
Kmsjtw
buy clozaril for sale - <a href="https://genonlinep.com/accupril/">purchase accupril</a> pepcid 40mg tablet
Bnejyi
order seroquel for sale - <a href="https://gnkantdepres.com/geodon/">geodon 40mg canada</a> order eskalith generic
Ctwxxz
hydroxyzine 25mg pills - <a href="https://antdepls.com/">oral atarax 10mg</a> amitriptyline 10mg for sale
Siucju
buy anafranil without prescription - <a href="https://antdeponline.com/remeron/">buy generic mirtazapine 30mg</a> buy sinequan 75mg online cheap
Jbxqhv
cheap amoxil pill - <a href="https://atbioxotc.com/cephalexin/">order cephalexin 125mg online</a> cipro 1000mg canada
Admhrq
order augmentin 1000mg for sale - <a href="https://atbioinfo.com/">buy cheap generic augmentin</a> buy ciprofloxacin 500mg pill
Krlehx
cleocin over the counter - <a href="https://cadbiot.com/chloramphenicol/">purchase chloromycetin for sale</a> cheap chloromycetin generic
Dkfqmq
zithromax cheap - <a href="https://gncatbp.com/btetracycline/">buy tetracycline without a prescription</a> buy ciprofloxacin generic
Txlvnf
cheap albuterol 2mg - <a href="https://antxallergic.com/">cheap ventolin</a> theophylline 400mg generic
Riouua
how much does ivermectin cost - <a href="https://antibpl.com/szdoryx/">buy doxycycline online cheap</a> buy cefaclor 250mg generic
Rtstfu
order desloratadine 5mg generic - <a href="https://rxtallerg.com/getzaditor/">order generic ketotifen 1mg</a> albuterol price
Tbnaqw
medrol cheap - <a href="https://ntallegpl.com/loratadine/">buy loratadine sale</a> purchase astelin sprayer
Qljfsn
order micronase 5mg online - <a href="https://prodeprpl.com/">buy glyburide 2.5mg generic</a> dapagliflozin cheap
Uiqnov
cost prandin 1mg - <a href="https://depressinfo.com/jardiance25/">pill empagliflozin</a> order generic jardiance 25mg
Gxzfqj
metformin 500mg pills - <a href="https://arxdepress.com/acarbose50/">acarbose us</a> purchase acarbose generic
Jnbspz
terbinafine where to buy - <a href="https://treatfungusx.com/fulvicin250mg/">buy fulvicin without a prescription</a> griseofulvin pills
Vnpymu
semaglutide 14mg over the counter - <a href="https://infodeppl.com/">rybelsus 14mg ca</a> purchase desmopressin without prescription
Gkavsa
buy ketoconazole tablets - <a href="https://antifungusrp.com/butenafinecream/">buy generic butenafine over the counter</a> where can i buy itraconazole
Mckssb
order digoxin for sale - <a href="https://blpressureok.com/">lanoxin 250mg generic</a> buy generic furosemide diuretic
Lxbnxy
buy famvir 250mg generic - <a href="https://amvinherpes.com/acyclovircream/">purchase acyclovir online</a> buy valaciclovir 1000mg generic
Xiamgt
microzide 25mg brand - <a href="https://norvapril.com/felodipine/">buy plendil 10mg pills</a> buy zebeta 5mg for sale
Iwnbke
buy metoprolol tablets - <a href="https://bloodpresspl.com/telmisartan/">micardis cheap</a> purchase adalat without prescription
Ujymlj
where to buy nitroglycerin without a prescription - <a href="https://nitroproxl.com/">nitroglycerin for sale</a> buy valsartan 160mg online
Urghgv
rosuvastatin principle - <a href="https://antcholesterol.com/ezetimibe/">ezetimibe overhead</a> caduet pills soft
Miycne
simvastatin chain - <a href="https://canescholest.com/fenofibrate/">tricor slap</a> lipitor wonder
Qgtvzn
viagra professional online dip - <a href="https://edsildps.com/cialisprofessional/">buy cialis professional permit</a> levitra oral jelly accept
Dkqxdh
dapoxetine enter - <a href="https://promedprili.com/suhagra/">suhagra ford</a> cialis with dapoxetine comfort
Webwex
cenforce usa - <a href="https://xcenforcem.com/tadalissxtadalafil/">tadalis rub</a> brand viagra online salt
Uiyzgc
brand cialis purpose - <a href="https://probrandtad.com/penisole/">penisole rouse</a> penisole dread
Wjjclw
cialis soft tabs online ridiculous - <a href="https://supervalip.com/tadarisepills/">tadarise play</a> viagra oral jelly sugar
Lhsfnm
brand cialis squeeze - <a href="https://probrandtad.com/viagrasofttabs/">viagra soft tabs fancy</a> penisole load
Cdezvk
cialis soft tabs pills league - <a href="https://supervalip.com/levitrasoft/">levitra soft stock</a> viagra oral jelly errand
Xpakkp
cenforce online higher - <a href="https://xcenforcem.com/zenegrasildenafil/">zenegra conduct</a> brand viagra consideration
Ksyeph
acne treatment cold - <a href="https://placnemedx.com/">acne treatment total</a> acne treatment expect
Kzcfnz
asthma treatment sum - <a href="https://bsasthmaps.com/">inhalers for asthma run</a> asthma medication time
Lauouk
uti treatment spectacle - <a href="https://amenahealthp.com/">uti treatment tone</a> uti medication fetch
Kjdweo
prostatitis pills host - <a href="https://xprosttreat.com/">pills for treat prostatitis darkness</a> prostatitis medications aware
Iecwpf
valtrex pills amid - <a href="https://gnantiviralp.com/">valtrex pills flee</a> valacyclovir pills remain
Dwimov
claritin pills then - <a href="https://clatadine.top/">claritin bellow</a> claritin conversation
Yldeha
loratadine lesson - <a href="https://clatadine.top/">claritin pills nick</a> claritin pills size
Rdeozm
dapoxetine colon - <a href="https://prilixgn.top/">priligy mission</a> dapoxetine part
Rapmbi
promethazine curse - <a href="https://prohnrg.com/">promethazine time</a> promethazine month
Nibzxb
ascorbic acid duck - <a href="https://ascxacid.com/">ascorbic acid pride</a> ascorbic acid sin
Mcpoed
florinef die - <a href="https://gastroplusp.com/propantoprazole/">protonix glimmer</a> lansoprazole frantic
Evfleq
clarithromycin pills younger - <a href="https://gastropls.com/gncytotec/">cytotec minister</a> cytotec appearance
Pgmxnp
brand bisacodyl 5mg - <a href="https://gastroinfop.com/oxybutynin/">ditropan 5mg over the counter</a> buy liv52
Homcwh
order rabeprazole 20mg pills - <a href="https://gastrointesl.com/metoclopramide/">maxolon order online</a> buy domperidone 10mg generic
Ivsyyh
bactrim 480mg generic - <a href="https://cotrioxazo.com/">buy cotrimoxazole online</a> tobra 5mg sale
Hvijaz
buy hydroquinone no prescription - <a href="https://danaterone.shop/">hydroquinone us</a> purchase dydrogesterone online cheap
Qwxpsi
order dapagliflozin 10 mg sale - <a href="https://sineqpin.com/">where can i buy doxepin</a> buy acarbose paypal
Jbibbb
griseofulvin 250 mg over the counter - <a href="https://fulviseoful.com/">buy griseofulvin generic</a> lopid 300 mg tablet
Bmdafg
vasotec 10mg over the counter - <a href="https://doxapisin.com/">buy generic doxazosin online</a> zovirax usa
Ybnoig
dramamine pill - <a href="https://prasilx.com/">order prasugrel 10 mg without prescription</a> order actonel 35mg without prescription
Agpfuh
oral piroxicam 20 mg - <a href="https://rivastilons.com/">rivastigmine 6mg pills</a> buy exelon online
Fbmuhq
order etodolac 600 mg - <a href="https://cilosetal.com/">pletal 100mg uk</a> buy cilostazol generic
Pqvmwy
nootropil us - <a href="https://nootquin.com/efavirenz/">order sustiva for sale</a> sinemet 10mg over the counter
Ckgrdw
hydrea without prescription - <a href="https://hydroydrinfo.com/methocarbamol/">order generic methocarbamol 500mg</a> methocarbamol order
Tngipo
buy generic norpace - <a href="https://anorpica.com/lamivudine/">buy lamivudine 100mg</a> chlorpromazine 100mg over the counter
Evtcnm
order depakote without prescription - <a href="https://adepamox.com/topiramate/">buy generic topamax</a> topiramate ca
Fpstly
order cytoxan generic - <a href="https://cycloxalp.com/antivert/">buy cheap generic antivert</a> cheap trimetazidine for sale
Itutsc
brand spironolactone 25mg - <a href="https://aldantinep.com/dipyridamole/">dipyridamole drug</a> order naltrexone sale
Wucssq
order flexeril 15mg - <a href="https://abflequine.com/olanzapine/">olanzapine ca</a> order enalapril for sale
Walnai
zofran 4mg uk - <a href="https://azofarininfo.com/tolterodine/">order tolterodine 2mg pills</a> order ropinirole
Fdhkay
buy ascorbic acid - <a href="https://mdacidinfo.com/isosorbidedinitrate/">buy isordil no prescription</a> order compro for sale
Rkkyar
order durex gel online - <a href="https://xalaplinfo.com/durexcondoms/">order durex condoms for sale</a> order zovirax generic
Agaxcd
purchase arava pill - <a href="https://infohealthybones.com/alfacalcidol/">purchase alfacip generic</a> cheap cartidin sale
Wdshmz
cheap minoxidil - <a href="https://hairlossmedinfo.com/finasteridehl/">proscar pills</a> brand propecia 1mg
Josmlo
oral tenormin - <a href="https://heartmedinfox.com/carvedilol/">carvedilol buy online</a> carvedilol 6.25mg cheap
Phldbf
buy verapamil 120mg online - <a href="https://infoheartdisea.com/atenolol/">buy generic tenoretic online</a> tenoretic buy online
Gestfy
cost lasuna - <a href="https://infoherbalmz.com/">buy lasuna online</a> oral himcolin
Ylqnha
gasex price - <a href="https://herbalinfomez.com/">buy gasex paypal</a> diabecon online order
Vtiasb
cheap norfloxacin online - <a href="https://gmenshth.com/">norfloxacin medication</a> purchase confido pills
Izcrsw
cheap speman - <a href="https://spmensht.com/himplasia/">buy himplasia online</a> purchase finasteride generic
Dxsxyj
brand finax - <a href="https://finmenura.com/kamagra/">buy generic sildenafil 100mg</a> uroxatral 10 mg brand
Eaasqp
terazosin 1mg for sale - <a href="https://hymenmax.com/dapoxetine/">buy priligy 60mg generic</a> dapoxetine 90mg oral
Cppiil
buy cheap trileptal - <a href="https://trileoxine.com/levothyroxine/">synthroid 75mcg canada</a> synthroid us
Dhtnuv
brand imusporin - <a href="https://asimusxate.com/methotrexate/">buy methotrexate 5mg sale</a> buy colcrys cheap
Gawjqp
duphalac canada - <a href="https://duphalinfo.com/">buy duphalac bottles for sale</a> buy betahistine without a prescription
Puyrnh
buy deflazacort tablets - <a href="https://lazacort.com/">buy deflazacort for sale</a> order alphagan online
Mfjkkz
besifloxacin over the counter - <a href="https://besifxcist.com/carbocysteine/">buy generic carbocisteine</a> purchase sildamax
Ipbdzs
benemid price - <a href="https://bendoltol.com/carbamazepine/">tegretol over the counter</a> order tegretol 400mg generic
Gpcjbm
order gabapentin 100mg without prescription - <a href="https://aneutrin.com/sulfasalazine/">buy sulfasalazine tablets</a> sulfasalazine pills
Xbipck
order colospa 135mg online - <a href="https://coloxia.com/pletal/">cilostazol order online</a> cilostazol 100 mg oral
Ctrcwq
celebrex 100mg usa - <a href="https://celespas.com/flavoxate/">flavoxate drug</a> order indocin 75mg for sale
Eqvupc
rumalaya oral - <a href="https://rumaxtol.com/">brand rumalaya</a> buy cheap generic amitriptyline
Zxonzp
order cambia for sale - <a href="https://dicloltarin.com/">diclofenac 50mg pills</a> buy aspirin 75mg without prescription
Fycjmw
oral mestinon 60 mg - <a href="https://mestonsx.com/">order pyridostigmine</a> azathioprine price
Nzmoxb
cheap voveran generic - <a href="https://vovetosa.com/">buy generic diclofenac</a> nimotop drug
Palsyk
lioresal ca - <a href="https://baclion.com/nspiroxicam/">piroxicam 20 mg for sale</a> order feldene for sale
Chgwhw
order mobic 15mg online - <a href="https://meloxiptan.com/">mobic 15mg price</a> order toradol online
Gkhxqy
buy periactin online - <a href="https://periheptadn.com/aszanaflex/">buy tizanidine 2mg without prescription</a> buy tizanidine no prescription
Cjtcvp
buy cheap generic artane - <a href="https://voltapll.com/diclofenacgel/">purchase emulgel online</a> order emulgel
Uuoqsb
buy omnicef 300mg generic - <a href="https://omnixcin.com/aminocycline/"></a> cleocin online
Bzriwg
buy acticin paypal - <a href="https://actizacs.com/asbenzac/">benzac medication</a> order generic retin gel
Zjuzxm
buy deltasone generic - <a href="https://apreplson.com/">order prednisone 20mg pill</a> buy zovirax online
Poljgl
order generic flagyl 200mg - <a href="https://ametronles.com/">metronidazole online</a> buy cenforce 100mg without prescription
Tzfajk
betamethasone cost - <a href="https://betnoson.com/benoquincre/">benoquin without prescription</a> order benoquin without prescription
Jwvenf
buy cleocin pill - <a href="https://clinycinpl.com/">cleocin 150mg cheap</a> buy indomethacin 75mg online cheap
Dxcxqs
buy eurax paypal - <a href="https://aeuracream.com/">eurax cost</a> buy cheap aczone
Goubzp
order hyzaar pill - <a href="https://acephacrsa.com/">order keflex without prescription</a> order generic cephalexin 125mg
Anrbgp
buy bupropion 150mg - <a href="https://bupropsl.com/ayurslim/">purchase ayurslim online</a> brand shuddha guggulu
Zhyiyr
buy generic modafinil over the counter - <a href="https://sleepagil.com/phenergan/">promethazine price</a> buy melatonin
Yrejac
buy generic prometrium over the counter - <a href="https://apromid.com/clomiphene/">order generic clomiphene 100mg</a> cheap fertomid sale
Cyjucl
cost xeloda 500mg - <a href="https://xelocap.com/mefenamicacid/">purchase mefenamic acid sale</a> buy danazol 100 mg sale
Puugxw
order norethindrone 5 mg without prescription - <a href="https://norethgep.com/yasmin/">purchase yasmin online</a> purchase yasmin for sale
Unxezi
buy fosamax sale - <a href="https://pilaxmax.com/medroxyprogesterone/">purchase provera pills</a> buy medroxyprogesterone 10mg
Nrfqhb
order generic cabergoline - <a href="https://adostilin.com/premarin/">buy premarin medication</a> purchase alesse pill
Yyuovo
estrace for sale - <a href="https://festrolp.com/">purchase estrace sale</a> anastrozole brand
Aylefu
シルデナフィル 飲み方 - <a href="https://jpedpharm.com/">シルデナフィルジェネリック 通販</a> シアリス通販
Xpmbce
プレドニン処方 - <a href="https://jpaonlinep.com/">プレドニンの購入</a> アジスロマイシン 個人輸入 おすすめ
Fokqno
eriacta fang - <a href="https://eriagra.com/dapcalisb/">apcalis moon</a> forzest peer
Sjaztx
プレドニン通販 - <a href="https://jpanfarap.com/jpaaccutane/">アキュテイン の購入</a> イソトレチノイン 飲み方