Skip to content
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

Distribute agents from separate container, not from API #1346

Merged
merged 11 commits into from
Dec 19, 2016
Merged

Conversation

tolusha
Copy link
Contributor

@tolusha tolusha commented Dec 14, 2016

What does this PR do?

Distribute agents from separate container, not from API

What issues does this PR fix or reference?

#1153

Previous Behavior

Agents were being downloaded from master.

New Behavior

Agents will be downloaded from dedicated docker container.

Tests written?

Manual testing

@tolusha tolusha changed the title Codenvy 1153 Distribute agents from separate container, not from API Dec 14, 2016
@benoitf
Copy link
Contributor

benoitf commented Dec 14, 2016

Is that 9000 port is a port that clients need to connect ? (if yes we have to check the port locally)
https://github.com/codenvy/codenvy/blob/master/dockerfiles/cli/scripts/cli.sh#L130-L135
it seems we should check the port in dev mode

To provide the agents, in the PR, you're using alpine + lighthttpd
as we're already requiring nginx image, shouldn't it be better to use nginx image ? so we don't require/need a new image

&& echo "server.port = 9000" >> /etc/lighttpd/lighttpd.conf \
&& ln -s /home/user/che /var/www/localhost/htdocs/agent-binaries

RUN addgroup -S user && adduser -S -g user user

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need user here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed.


EXPOSE 9000

CMD ["lighttpd", "-f", "/etc/lighttpd/lighttpd.conf", "-D"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is lighttpd.conf ? maybe we need generate that config with puppet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. should be managed by puppet

@riuvshin
Copy link

riuvshin commented Dec 14, 2016

@benoitf no 9000 port is internal all connections will be to haproxy like <API_END_POINT>/agent-binaries

@benoitf
Copy link
Contributor

benoitf commented Dec 14, 2016

@riuvshin

+<% if scope.lookupvar('compose::env') != 'production' -%>
 +    ports:
 +      - '9000:9000'
 +<% end -%>

@riuvshin
Copy link

yes this is for dev mode, I've asked to add this because I thought it will be tomcat and we will need be able to debug it in dev mode. so we have to remove that part.
that container with agents was added as haproxy backend so all clients will connect to haproxy

@tolusha
Copy link
Contributor Author

tolusha commented Dec 14, 2016

@benoitf
The task is about to add a dedicated container not to reuse existed one.

Copy link

@riuvshin riuvshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benoitf
Copy link
Contributor

benoitf commented Dec 14, 2016

@tolusha yes I was talking about image, not the container

- '<%= scope.lookupvar('compose::codenvy_folder') -%>/config/lighttpd/lighttpd.conf:/etc/lighttpd/lighttpd.conf'
<% if scope.lookupvar('compose::env') != 'production' -%>
ports:
- '9000:9000'
Copy link
Contributor

@benoitf benoitf Dec 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this code is still there
then
https://github.com/codenvy/codenvy/blob/master/dockerfiles/cli/scripts/cli.sh#L130-L135 need to check 9000 port

if the local listener is dropped, then no need to check this port

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anatoly wanted to keep open that port in dev mode to test server without codenvy.
We don;t need check this port I think as it is only in dev mode
(but I still want OK to remove that.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either code is removed or either the port is checked in dev mode (as we do for debug port)


RUN apk update \
&& apk add lighttpd \
&& ln -s /data /var/www/localhost/htdocs/agent-binaries
Copy link
Contributor

@benoitf benoitf Dec 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to reduce size of the image, cache of apk is usually dropped as /tmp folder :
rm -rf /var/cache/apk/* and sometimes /tmp folder

mv ${DEPENDENCY_DIR}/${prefix}/terminal/exec-agent-${prefix}.tar.gz ${DEPENDENCY_DIR}/${prefix}/terminal/websocket-terminal-${prefix}.tar.gz
done

mvn dependency:copy -Dartifact=com.codenvy.onpremises:onpremises-ide-packaging-tomcat-ext-server:${POM_VERSION}:tar.gz \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use a maven pom + assembly.xml file to copy all the required dependencies ?
then we could only call a single maven command

class lighttpd {
file { "/opt/codenvy/config/lighttpd":
ensure => "directory",
mode => "755",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need execute permissions ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is common folder permission we always use that mode for folders we manage

@@ -0,0 +1,323 @@
###############################################################################
# Default lighttpd.conf for Gentoo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure comment is accurate as we're based on alpine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is default content of lighttpd.conf it have info for all operations systems I think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but here we can keep only what is interesting

# for >= linux-2.6
# server.event-handler = "linux-sysepoll"
# for FreeBSD
# server.event-handler = "freebsd-kqueue"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it's linux so no need to have comments around FreeBSD

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is default content of lighttpd.conf

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we don't need default values

rm -rf ${DEPENDENCY_DIR}

TERMINAL_AGENTS=("org.eclipse.che:exec-agent:${POM_VERSION}:tar.gz:linux_amd64"
"org.eclipse.che:exec-agent:${POM_VERSION}:tar.gz:linux_arm7");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in which case the linux_arm7 will work ?
as all docker containers being based on linux/amd64 I don't see a usecase where arm arch will work ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only case I can see is in creating ssh machine (artic device)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

# debug.log-file-not-found = "enable"
# }}}

# vim: set ft=conf foldmethod=marker et :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could drop tons of the commented lines ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is default content of that config, Im OK to drop comments.

@tolusha
Copy link
Contributor Author

tolusha commented Dec 15, 2016

@benoitf
Updated

@riuvshin
Copy link

@tolusha Please prvide PR for customer-saas same way, you may need @benoitf help

Copy link
Contributor

@skabashnyuk skabashnyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple of question

  1. Why don't you use existed nginx image?
  2. In future how are you going to provide authentication for this client. Maybe you should take a look on some http server implemented on GO. we have authentication implemented for go based terminal

@skabashnyuk skabashnyuk self-requested a review December 15, 2016 13:44
@tolusha
Copy link
Contributor Author

tolusha commented Dec 15, 2016

lighttpd is the most light weight web serve I've found. That's was the purpose of using it.

@tolusha
Copy link
Contributor Author

tolusha commented Dec 16, 2016

@skabashnyuk
Whose answer you are waiting for?
There weren't any requirements concerning authentication or specific webserver.
If you need this feel free to create a new issue.

@skabashnyuk
Copy link
Contributor

ok up to you

@skabashnyuk skabashnyuk requested review from skabashnyuk and removed request for skabashnyuk December 16, 2016 08:26
@tolusha tolusha removed the request for review from garagatyi December 19, 2016 08:23
@tolusha tolusha merged commit ab5383c into master Dec 19, 2016
@tolusha tolusha deleted the CODENVY-1153 branch December 19, 2016 08:28
benoitf pushed a commit that referenced this pull request Dec 20, 2016
* CODENVY-1153: Distribute agents from separate container, not from API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants