Search Results

Search found 4 results on 1 pages for 'sheriffen'.

Page 1/1 | 1 

  • Systemd Service Start With Dynamic Port Value From Docker

    - by Sheriffen
    Using CoreOS, Docker and systemd to manage my services I want to properly perform service discovery. Since CoreOS utilizes etcd (distributed key-value) there is a very convenient way to do this. On systemd's ExecStartPost I can just insert the started service into etcd without problems. My usecase needs something like this: ExecStartPost=/usr/bin/etcdctl set /services/myServiceName '{ \"host\": \"%H\", \"port\": 5555 }' which works like a charm. But this is where my idea popped up. Docker has the power to randomly assign a port if I just run docker run -p 5555 which is awesome since I don't have to set it statically in the *.service file and I could possibly run multiple instances on the same host. What if I could get the randomly assigned port and insert instead of the static 5555? Turns out I can use the docker port command to get the port and with some formatting we can get just the port with $(echo $(/usr/bin/docker port my-container-name 5555) | cut -d':' -f2) which works if I set it (using bash) like this: /usr/bin/etcdctl set /services/myServiceName '{ \"host\": \"%H\", \"port\": '$(echo $(/usr/bin/docker port my-container-name 5555) | cut -d':' -f2)' }' but using systemd I just can't get it to work. This is the code I'm using: ExecStartPost=/usr/bin/etcdctl set /services/myServiceName '{ \"host\": \"%H\", \"port\": '$(echo $(/usr/bin/docker port my-container-name 5555) | cut -d':' -f2)'}' Somehow I got something wrong but it's hard to debug since it works when typed in the terminal.

    Read the article

  • MySQL max_user_connections

    - by Sheriffen
    We're releasing a site in a couple of weeks that has been developed on a local machine but now when were testing on dev server we get MySQL error 'max_user_connections'. We have talked to the host company (biggest in sweden) and they say that we don't close our connections properly. But the thing is that we user the EXACT same code on another host where it works. And I also added echo "closed"; in the database_close function so that now in the very bottom of very page there is "closed". To me this means that we do close the connection, anyone got any idea of what could be wrong? We connect through the PHP PDO function and closes it by setting it to 'null', all according to the manual.

    Read the article

  • Exclude rows with Doctrine ORM DQL (NOT IN)

    - by Sheriffen
    I'm building a chat application with codeigniter and doctrine. Tables: - User - User_roles - User_available Relations: ONE user have MANY roles. ONE user_available have ONE user. Users available for chatting will be in the user_available table. Problem: I need to get all users in in user_available that hasn't got role_id 7. So I need to express in DQL something like (this is not even SQL, just in words): SELECT * from user_available WHERE NOT user_available.User.Role.role_id = 7 Really stuck on this one EDIT: Guess I was unclear. The tables are already mapped and Doctrine does the INNER JOIN job for me. I'm using this code to get the admin that waited the longest but now I need the user: $admin = Doctrine_Query::create() ->select('c.id') ->from('Chat_available c') ->where('c.User.Roles.role_id = ?', 7) ->groupBy('c.id') ->orderBy('c.created_at ASC') ->fetchOne(); Now I need to get the user that waited the longest but this does NOT work $admin = Doctrine_Query::create() ->select('c.id') ->from('Chat_available c') ->where('c.User.Roles.role_id != ?', 7) ->groupBy('c.id') ->orderBy('c.created_at ASC') ->fetchOne();

    Read the article

  • Jquery JSON .each() doesnt work in Google Chrome

    - by Sheriffen
    I have a really simple chat application on a site which works pretty good. It requests by ajax like this: $.ajax({ url: "fetch/"+CHAT_SESSION_ID+"/"+LAST_MESSAGE_ID, dataType: "json", cache: false, success: function(data) { if (data.session_active == 0) { //If other chatter ended session alert("Session Ended"); } else { $.each(data.messages, function(i,msg){ alert(msg.message.Body); )}; } } }); and gets a json response that lookes like this: { "session_active": "1", "messages": [ {"message": {"MsgID": "100", "UserID": "1", "Body": "heyy"}}, ]} It works really well in at least FF and Saf but in Chrome it never gets past the .each! This is driving me nuts, have tried everything I've come across online for days but I can't seem to get it right. Please someone help! I can provide testserver if someone wants to firebug it themselves ;)

    Read the article

1