YannickB / odoo-hosting

Other
64 stars 50 forks source link

Proxy doesnt redirect to my odoo instance #31

Closed ErrafayM closed 8 years ago

ErrafayM commented 9 years ago

Hello , Following your tutorial i have succeded with all steps until now . after creating a base everything seemed to work . my odoo instance got created and the database , but when i try to get into my instance through the base url it doesnt work . here the log from the base creation .

connect: ssh www-bind_192.168.1.6 command : sed -i "/clou\sIN\sCNAME/d" /etc/bind/db.errafay.net stdout : stderr : command : /etc/init.d/bind9 reload stdout : Reloading domain name service...: bind9.

stderr : connect: ssh shinken@www-shinken_192.168.1.6 command : rm /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : /etc/init.d/shinken reload stdout : stderr : bash: /etc/init.d/shinken: No such file or directory

connect: ssh www-postfix_192.168.1.6 command : sed -i "/^mydestination =/ s/, clou.errafay.net//" /etc/postfix/main.cf stdout : stderr : command : sed -i "/@clou.errafay.net/d" /etc/postfix/virtual_aliases stdout : stderr : command : postmap /etc/postfix/virtual_aliases stdout : stderr : command : sed -i "/d\sclouder_clou_errafay_net/d" /etc/aliases stdout : stderr : command : newaliases stdout : stderr : command : /etc/init.d/postfix reload stdout : Reloading Postfix configuration...done.

stderr : connect: ssh www-proxy_192.168.1.6 command : rm /etc/nginx/sites-enabled/clouder-clou-errafay-net stdout : stderr : rm: cannot remove /etc/nginx/sites-enabled/clouder-clou-errafay-net: No such file or directory

command : rm /etc/nginx/sites-available/clouder-clou-errafay-net stdout : stderr : rm: cannot remove /etc/nginx/sites-available/clouder-clou-errafay-net: No such file or directory

command : rm /etc/ssl/certs/clou.errafay.net. stdout : stderr : rm: cannot remove /etc/ssl/certs/clou.errafay.net.: No such file or directory

command : rm /etc/ssl/private/clou.errafay.net. stdout : stderr : rm: cannot remove /etc/ssl/private/clou.errafay.net.: No such file or directory

command : /etc/init.d/nginx reload stdout : Reloading nginx configuration: nginx.

stderr : connect: ssh postgres@www-postgres_192.168.1.6 command : psql -c "update pg_database set datallowconn = 'false' where datname = 'clouder_clou_errafay_net'; SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = 'clouder_clou_errafay_net';" stdout : stderr : ERROR: column "procpid" does not exist LINE 1: ...er_clou_errafay_net'; SELECT pg_terminate_backend(procpid) F... ^

command : dropdb clouder_clou_errafay_net stdout : stderr : connect: ssh odoo@www-clouder_192.168.1.6 command : rm -rf /opt/odoo/test/filestore/clouder_clou_errafay_net stdout : stderr : connect: ssh postgres@www-postgres_192.168.1.6 command : psql -c "update pg_database set datallowconn = 'false' where datname = 'clouder_clou_errafay_net'; SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = 'clouder_clou_errafay_net';" stdout : stderr : ERROR: column "procpid" does not exist LINE 1: ...er_clou_errafay_net'; SELECT pg_terminate_backend(procpid) F... ^

command : dropdb clouder_clou_errafay_net stdout : stderr : dropdb: database removal failed: ERROR: database "clouder_clou_errafay_net" does not exist

connect: ssh odoo@www-clouder_192.168.1.6 command : rm -rf /opt/odoo/test/filestore/clouder_clou_errafay_net stdout : stderr : connect: ssh odoo@www-clouder_192.168.1.6 command : mkdir -p /opt/odoo/test/filestore/clouder_clou_errafay_net stdout : stderr : client = erppeek.Client('http://192.168.1.6:14019') client.create_database('dUpJOfA5PD78Zrdkc6Nn','clouder_clou_errafay_net',demo=False,lang='en_US',user_password='XwSWRx8WKILcMEce5C2c') Database created client = erppeek.Client('http://192.168.1.6:14019,db=clouder_clou_errafay_net,user='admin', password=XwSWRx8WKILcMEce5C2c) admin_id = client.model('ir.model.data').get_object_reference('base', 'user_root')[1] client.model('res.users').write([1], {'login': admin}) extended_group_id = client.model('ir.model.data').get_object_reference('base', 'group_no_one')[1] client.model('res.groups').write([8], {'users': [(4, 1)]}) client.install(clouder) client = erppeek.Client('http://192.168.1.6:14019, db=clouder_clou_errafay_net, user=admin, password=XwSWRx8WKILcMEce5C2c) company_id = client.model('ir.model.data').get_object_reference('base', 'main_company')[1] client.model('res.company').write([1], {'name':der}) config_ids = client.model('ir.config_parameter').search([('key','=','web.base.url')]) client.model('ir.config_parameter').write([1], {'value': 'http://clou.errafay.net}) config_ids = client.model('ir.config_parameter').search([('key','=','ir_attachment.location')]) client.model('ir.config_parameter').create({'key': 'ir_attachment.location', 'value': 'file:///filestore'}) Saving 2015-06-23-104037_clouder-clou-errafay-net Comment: Manual connect: ssh odoo@www-clouder_192.168.1.6 command : mkdir -p /base-backup/2015-06-22_clou_errafay.net stdout : stderr : command : pg_dump -O -h postgres -U www_clouder_test clouder_clou_errafay_net > /base-backup/2015-06-22_clou_errafay.net/clouder_clou_errafay_net.dump stdout : stderr : connect: ssh odoo@www-clouder_192.168.1.6 command : cp -R /opt/odoo/test/filestore/clouder_clou_errafay_net /base-backup/2015-06-22_clou_errafay.net/filestore stdout : stderr : command : chmod -R 777 /base-backup/2015-06-22_clou_errafay.net stdout : stderr : connect: ssh www-clouder_192.168.1.6 command : rm -rf /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : mkdir /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : cp -R /base-backup/2015-06-22_clou_errafay.net/* /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : echo "2015-06-23" > /tmp/2015-06-22_clou_errafay.net/backup-date stdout : stderr : command : chmod -R 777 /tmp/2015-06-22_clou_errafay.net stdout : stderr : connect: ssh backup@www-backup_192.168.1.6 command : rm -rf /opt/backup/list/clouder_clou_errafay_net stdout : stderr : command : mkdir -p /opt/backup/list/clouder_clou_errafay_net stdout : stderr : command : echo "2015-06-22_clou_errafay.net" > /opt/backup/list/clouder_clou_errafay_net/repo stdout : stderr : send : /home/odoo/.ssh/config to /home/backup/.ssh/config send : /home/odoo/.ssh/keys/www-clouder_192.168.1.6.pub to /home/backup/.ssh/keys/www-clouder_192.168.1.6.pub send : /home/odoo/.ssh/keys/www-clouder_192.168.1.6 to /home/backup/.ssh/keys/www-clouder_192.168.1.6 command : chmod -R 700 /home/backup/.ssh stdout : stderr : command : rm -rf /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : mkdir /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : rsync -e 'ssh -o StrictHostKeyChecking=no' -ra www-clouder_192.168.1.6:/tmp/2015-06-22_clou_errafay.net/ /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : export BUP_DIR=/opt/backup/bup; bup index /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : export BUP_DIR=/opt/backup/bup; bup save -n 2015-06-22_clou_errafay.net -d 1435056037 --strip /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : rm -rf /tmp/2015-06-22_clou_errafay.net stdout : stderr : command : rm /home/backup/.ssh/keys/ stdout : stderr : connect: ssh www-clouder_192.168.1.6 command : rm -rf /tmp/2015-06-22_clou_errafay.net* stdout : stderr : connect: ssh odoo@www-clouder_192.168.1.6 command : rm -rf /base-backup/2015-06-22_clou_errafay.net stdout : stderr : connect: ssh www-bind_192.168.1.6 command : sed -i "/clou\sIN\sCNAME/d" /etc/bind/db.errafay.net stdout : stderr : command : /etc/init.d/bind9 reload stdout : Reloading domain name service...: bind9.

stderr : connect: ssh www-bind_192.168.1.6 command : echo "clou IN CNAME 192.168.1.6." >> /etc/bind/db.errafay.net stdout : stderr : command : echo "IN MX 1 192.168.1.6. ;clou IN CNAME" >> /etc/bind/db.errafay.net stdout : stderr : command : /etc/init.d/bind9 reload stdout : Reloading domain name service...: bind9.

stderr : connect: ssh shinken@www-shinken_192.168.1.6 command : rm /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : rm: cannot remove /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg: No such file or directory

command : /etc/init.d/shinken reload stdout : stderr : bash: /etc/init.d/shinken: No such file or directory

connect: ssh shinken@www-shinken_192.168.1.6 send : /home/odoo/odoo-dev/odoo/addons/clouder-8.0/clouder_template_shinken/res/base-shinken.config to /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg command : sed -i "s/TYPE/base/g" /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : sed -i "s/UNIQUE_NAME/clouder_clou_errafay_net/g" /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : sed -i "s/DATABASES/clouder_clou_errafay_net/g" /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : sed -i "s/BASE/clou/g" /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : sed -i "s/DOMAIN/errafay.net/g" /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : sed -i "s/METHOD/bup/g" /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : sed -i "s/CONTAINER/www-backup_192.168.1.6/g" /usr/local/shinken/etc/services/clouder-clou-errafay-net.cfg stdout : stderr : command : /etc/init.d/shinken reload stdout : stderr : bash: /etc/init.d/shinken: No such file or directory

command : rm -rf /home/shinken/.ssh/keys/www-backup_192.168.1.6* stdout : stderr : send : /home/odoo/.ssh/keys/www-backup_192.168.1.6.pub to /home/shinken/.ssh/keys/www-backup_192.168.1.6.pub send : /home/odoo/.ssh/keys/www-backup_192.168.1.6 to /home/shinken/.ssh/keys/www-backup_192.168.1.6 command : chmod -R 700 /home/shinken/.ssh stdout : stderr : command : sed -i '/Host www-backup_192.168.1.6/,/END www-backup_192.168.1.6/d' /home/shinken/.ssh/config stdout : stderr : command : echo "Host www-backup_192.168.1.6" >> /home/shinken/.ssh/config stdout : stderr : command : echo " Hostname 192.168.1.6" >> /home/shinken/.ssh/config stdout : stderr : command : echo " Port 14005" >> /home/shinken/.ssh/config stdout : stderr : command : echo " User backup" >> /home/shinken/.ssh/config stdout : stderr : command : echo " IdentityFile ~/.ssh/keys/www-backup_192.168.1.6" >> /home/shinken/.ssh/config stdout : stderr : command : echo "#END www-backup_192.168.1.6" >> ~/.ssh/config stdout : stderr : connect: ssh www-postfix_192.168.1.6 command : sed -i "/^mydestination =/ s/, clou.errafay.net//" /etc/postfix/main.cf stdout : stderr : command : sed -i "/@clou.errafay.net/d" /etc/postfix/virtual_aliases stdout : stderr : command : postmap /etc/postfix/virtual_aliases stdout : stderr : command : sed -i "/d\sclouder_clou_errafay_net/d" /etc/aliases stdout : stderr : command : newaliases stdout : stderr : command : /etc/init.d/postfix reload stdout : Reloading Postfix configuration...done.

stderr : client = erppeek.Client('http://192.168.1.6:14019,db=clouder_clou_errafay_net,user=admin, password=XwSWRx8WKILcMEce5C2c) connect: ssh www-postfix_192.168.1.6 command : sed -i "/^mydestination =/ s/$/, clou.errafay.net/" /etc/postfix/main.cf stdout : stderr : command : echo "@clou.errafay.net clouder_clou_errafay_net@localhost" >> /etc/postfix/virtual_aliases stdout : stderr : command : postmap /etc/postfix/virtual_aliases stdout : stderr : command : echo 'clouder_clou_errafay_net: "|openerp_mailgate.py --host=192.168.1.6 --port=14019 -u 1 -p XwSWRx8WKILcMEce5C2c -d clouder_clou_errafay_net"' >> /etc/aliases stdout : stderr : command : newaliases stdout : stderr : command : /etc/init.d/postfix reload stdout : Reloading Postfix configuration...done.

stderr : connect: ssh www-proxy_192.168.1.6 command : rm /etc/nginx/sites-enabled/clouder-clou-errafay-net stdout : stderr : rm: cannot remove /etc/nginx/sites-enabled/clouder-clou-errafay-net: No such file or directory

command : rm /etc/nginx/sites-available/clouder-clou-errafay-net stdout : stderr : rm: cannot remove /etc/nginx/sites-available/clouder-clou-errafay-net: No such file or directory

command : rm /etc/ssl/certs/clou.errafay.net. stdout : stderr : rm: cannot remove /etc/ssl/certs/clou.errafay.net.: No such file or directory

command : rm /etc/ssl/private/clou.errafay.net. stdout : stderr : rm: cannot remove /etc/ssl/private/clou.errafay.net.: No such file or directory

command : /etc/init.d/nginx reload stdout : Reloading nginx configuration: nginx.

stderr : connect: ssh www-proxy_192.168.1.6 send : /home/odoo/odoo-dev/odoo/addons/clouder-8.0/clouder_template_odoo/res/proxy.config to /etc/nginx/sites-available/clouder-clou-errafay-net command : sed -i "s/BASE/clou/g" /etc/nginx/sites-available/clouder-clou-errafay-net stdout : stderr : command : sed -i "s/DOMAIN/errafay.net/g" /etc/nginx/sites-available/clouder-clou-errafay-net stdout : stderr : command : sed -i "s/SERVER/192.168.1.6/g" /etc/nginx/sites-available/clouder-clou-errafay-net stdout : stderr : command : sed -i "s/PORT/14019/g" /etc/nginx/sites-available/clouder-clou-errafay-net stdout : stderr : command : openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out /etc/ssl/certs/clou.errafay.net.crt -keyout /etc/ssl/private/clou.errafay.net.key -subj "/C=FR/L=Paris/O=errafay/CN=clou.errafay.net" stdout : stderr : Generating a 2048 bit RSA private key ............................................................+++ .........................................+++

writing new private key to '/etc/ssl/private/clou.errafay.net.key'

command : ln -s /etc/nginx/sites-available/clouder-clou-errafay-net /etc/nginx/sites-enabled/clouder-clou-errafay-net stdout : stderr : command : /etc/init.d/nginx reload stdout : Reloading nginx configuration: nginx.

YannickB commented 9 years ago

I see no error in the log so I bet on the DNS error. Did you tried to set the domain name directly in your hosts file ? I'd like to know if the problem come from the DNS or from the proxy.

Why I think it's the DNS : maybe you didn't set your server as the dns server who manage your domain.

ErrafayM commented 9 years ago

yes i tried to set the domain in my /etc/hosts still same problem . and for your last question i think thats the problem all though i dont know how should i do it. can you tell me what should i modify ? sorry for the trouble , i'm not to handy with dns.

YannickB commented 9 years ago

Ok so if you set the hosts file the problem does not come from DNS. What happen if you try to connect directly to the Odoo server through his port? for example mydomain.com:42001 This way you bypass the nginx proxy and see if the problem come from it, you can find the port used by checking the container record in clouder

Three possibility : -You get directly the odoo base you created, the problem come from the proxy then -You get redirected to the database creation form, it means odoo didn't recognized the domain name with the name of the database (db_filter param) -You get an error and no odoo page, then your odoo container isn't working or can't connect to database.

ErrafayM commented 9 years ago

I can get through to the odoo instance using "192.168.1.6:14019" and i get to the database creation form .

YannickB commented 9 years ago

Ok, and if you try mybasename.domainofhebase:14019 ? Remember Odoo take the domain you used to connect to it to redirect you to the correct database. This will also check your configuration on the /etc/hosts works.

ErrafayM commented 9 years ago

still and said could not resolv the hosts address. so it's probably the dns ?

/etc/hosts

127.0.0.1 localhost 127.0.1.1 debian 192.168.1.6 clou.errafay.net clou

::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters

can you check if it's well configured this is the /etc/hosts in my docker server.

YannickB commented 9 years ago

ok I see the problem, for now we are bypassing the dns with the hosts file, you need the line

192.168.1.6 clou.errafay.net

in the hosts file of your local machine, not on the docker server. Note that 192.168.1.6 is a local ip, you can only use this ip if you are on the same network than your docker server.

Then try clou.errafay.net:14019 on your browser to see what happen.

ErrafayM commented 9 years ago

My bad. made the change , and the clou.errafay.net:14019 works on my client . and i can see my db when clou.errafay.net:14019/web/database/manager .

YannickB commented 9 years ago

Good! And when you try directly clou.errafay.net?

ErrafayM commented 9 years ago

--2015-06-23 14:56:31-- http://clou.errafay.net/ Resolving clou.errafay.net (clou.errafay.net)... 192.168.1.6 Connecting to clou.errafay.net (clou.errafay.net)|192.168.1.6|:80... failed: Connection refused.

YannickB commented 9 years ago

Ok, you assigned the port 80 to your proxy container? At the very least, it's clear the problem come from the proxy configuration

ErrafayM commented 9 years ago

yes i did , here is the default configuration generated .if it can help .............................................................................................................................................................................. server { listen 80; server_name clou.errafay.net;

keepalive_timeout   60;

# proxy buffers
proxy_buffers 16 64k;
proxy_buffer_size 128k;

## default location ##
location / {
    proxy_pass  http://192.168.1.6:14019;
    # force timeouts if the backend dies
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    proxy_redirect off;

    # set headers
    proxy_set_header    Host            $host;
    proxy_set_header    X-Real-IP       $remote_addr;
    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto https;

    proxy_connect_timeout       3600;
    proxy_send_timeout          3600;
    proxy_read_timeout          3600;
    send_timeout                3600;
}

# cache some static data in memory for 60mins
location ~* /web/static/ {
    proxy_cache_valid 200 60m;
    proxy_buffering on;
    expires 864000;
    proxy_pass http://192.168.1.6:14019;
}

}

server { listen 443; server_name clou.errafay.net;

# ssl files
ssl on;
ssl_certificate     /etc/ssl/certs/clou.errafay.net.crt;
ssl_certificate_key /etc/ssl/private/clou.errafay.net.key;

# limit ciphers
ssl_ciphers             HIGH:!ADH:!MD5;
ssl_protocols           SSLv3 TLSv1;
ssl_prefer_server_ciphers on;

# proxy buffers
proxy_buffers 16 64k;
proxy_buffer_size 128k;

## default location ##
location / {
    proxy_pass  http://192.168.1.6:14019;
    # force timeouts if the backend dies
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    proxy_redirect off;

    # set headers
    proxy_set_header    Host            $host;
    proxy_set_header    X-Real-IP       $remote_addr;
    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto https;

    proxy_connect_timeout       3600;
    proxy_send_timeout          3600;
    proxy_read_timeout          3600;
    send_timeout                3600;
}

# cache some static data in memory for 60mins
location ~* /web/static/ {
    proxy_cache_valid 200 60m;
    proxy_buffering on;
    expires 864000;
    proxy_pass http://192.168.1.6:14019;
}

}

YannickB commented 8 years ago

Do you still have issues with this ticket ?

ErrafayM commented 8 years ago

Yes.

ErrafayM commented 8 years ago

does it have something with #54 ?

YannickB commented 8 years ago

No I don't think there is any link between the proxy and the dns containers

ErrafayM commented 8 years ago

This issue was fixed.