-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database Schema missing #123
Comments
Hi @victorseth, thank you for trying Network API. I think the documentation guided you wrong. You can just load the It sound like you are installing it by hand. I encourage you to try using docker to run the project: # Get to project root directory and run
$> docker-compose up -d We will update the documentation with those informations. If you have other problems, please let us know. Regards. |
Hi @pantuza When i try to use mysql to import the SQL file: this sql doesn't have the db schema. Where do I get it? |
Try it by doing: mysql -u root -h localhost -e 'drop database if exists networkapi;'
mysql -u root -h localhost -e 'create database networkapi;'
cd /vagrant/dbmigrate; db-migrate --show-sql
mysql -u root -h localhost networkapi < /vagrant/dev/load_example_environment.sql As you are trying to install it manually, take a look at this file, that is a bash to run Network API inside a Vagrant VM. Some commands there may also help you. |
Thanks for your time! I'm trying to make it work with docker, but it is complaining about my docker version. EDIT: Docker now works, BUT, what do I do after the "docker-compose up -d" |
Hi @victorseth, After "docker-compose up -d" you should check containers by "docker ps --all". There are lots of good docker tutorials. I think these two are good to start with. One for docker and one for compose: For Network API I also recommend you to always verify the logs. They are at Tip: To get a shell within the application docker container use: Regards |
Checking logs: I think there is something wrong with netapi_db from docker. |
Ok. It should not happen. I will recreate locally my environment and check if the problem occurs. |
Same error after restarting "ERR_CONNECTION_REFUSED", this is the full error on networkapi.log: [ERROR] 25/Sep/2017:16:17:34 +0000 - U:NoRequestUser, P:/favicon.ico, C:NoRequestContext, N:gunicorn.error:143 , T:K2FKCI4UQESMBIQ1ZFGOUA, MSG:Error handling request Now after restarting, there is no new log. Still not working. |
Ok. Please paste here the following commands:
And also, refer to this page and check if docker version is compatible with the v3 of docker-compose file format. Your docker version should be greater than 1.13.0+ |
Docker version 17.09.0-ce-rc3, build 2357fb2 |
Ok, let's try this way:
As our problem seems to be at the Database container, let's check it by running:
Also, log into the application container and try to ping the database container: Verify if all containers are up and running: |
--- netapi_db ping statistics --- docker ps --all show 5 containers from netapi. |
Sounds like everything is now ok. Do a request to the API to see if it is working: You should see a Json as a response. |
curl: (56) Recv failure: Connection reset by peer |
Check if the port 8000 is open: |
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN Open. |
Try to switch localhost to 127.0.0.1. Your OS may not resolving localhost:
|
Where do I change it? gunicorn.conf.py? |
Switch it on the curl: |
Same message |
Ok. Seems like the OS is blocking the request. Two things now:
|
Proto Recv-Q Send-Q Local Address Foreign Address State Can't install curl and can't ping outside. I think this is the problem. Do docker have an interface that interacts with the external network? |
Yes it has. Ok, sounds like you have a networking problem at the OS. Please paste here the result of the following commands:
Within the container (netapi_app):
|
OUTSIDE CONTAINER sysctl resolv.conf Generated by NetworkManagernameserver 8.8.8.8 ifconfig(removing only my IP with XXX.XXX.XXX.XXX) docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 veth0218642: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 veth0b1b4bd: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 veth107ebf6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 veth24123f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 vetha3e927e: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 |
INSIDE CONTAINER netstat ping nslookup |
Ok. Thank you for the results. Run inside the container the DNS search using other DNS server like OpenDNS:
Outside the container, please provide the routing information:
|
nslookup route |
Ok. Good. Let's see the docker information about the networking:
What Linux distribution are you using? |
[ I'm using CentOS 7 |
Things seems ok. One container pings another, right? The container pings the host machine? |
Ok, explaining I'm using my PC to access a server hosting a CentOS 7. So i'm acessing XXX.XXX.XXX.XXX:8000 from my PC. Pinging from inside I can ping the server IP (XXX.XXX.XXX.XXX) but can't ping any other address on the same subnet from the INSIDE container. |
Ok. So you are logged into XXX server using SSH, right? Within the server (not the container), does the ping and the nslookup works?
Let's consider this server XXXX as our host machine where the container are running on. |
--- globo.com ping statistics --- Server: 8.8.8.8 Non-authoritative answer: Yes, ping and lookup. |
Ok, perfect! I would suggest now to restart the docker service on OS. Seems like the bridge is not forwarding traffic from docker to local interface. When restart occurs, all containers goes down. So, do as follows:
Then, check if you can ping, lookup or even install curl. What is the Linux distribution of the host machine? |
Worked. I can ping. Curl installed. Then: |
Nice. Network is OK. this curl connection refused were from host machine or inside the container? We had stopped at curl on application running from inside the container:
If it does not work please paste the result of |
netstat (from inside container) shows: tailing (from outside): |
So, the application/server is not up. Go to host machine and check if all containers are running Then restart only the application container |
All up. I just installed nmap inside the container and then scanned port 8000 from the inside, port 8000: Host is up (0.000075s latency). It must be "open", right? |
Does the curl from inside the container works now? . Check the port 8000 |
Proto Recv-Q Send-Q Local Address Foreign Address State curl: (7) Failed to connect to localhost port 8000: Connection refused |
Inside the container, paste the result of Do you have any other software that are using port 8000 at host machine? |
Now just worked: Tried curl and return JSON Acessing from another PC , XXX.XXX.XXX.XXX:8000 still returning ERR_CONNECTION_REFUSED |
Great! Now the Network API is running 👍 As the name says, it is a API. It does not have an user interface. I encorage you to check Network API UI project that will bring you a WEB interface to register equipments, networks, IPs and etc. All through web forms. Thank you for trying Globo Network API. |
I just used curl from INSIDE enviroment, outside from the same machine worked too IF i use "localhost" instead of the XXX.XXX.XXX.XXX. But curl from another machine via IP or from the same machine via IP XXX.XXX.XXX.XXX curl: (7) couldn't connect to host And I installed WebUI and it's up, but I can't access it via my IP:8080 (WebUI) |
Good day,
I was installing the API but I got stuck on the Schema import part:
mysql -u <user> -p <password> -h <host> <dbname> < $NETWORKAPI_FOLDER/dev/database_configuration.sql
There is no database_configuration.sql file in the dev folder. What am I missing?
The text was updated successfully, but these errors were encountered: