-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix Janitor configuration; #207
Conversation
Wow, super cool! Thanks for working on this fix. 😄 I also don't see anything wrong with your approach. Have you looked at |
Actually, scratch my issue: by cargo culting https://github.com/allisson/docker-postgresql/blob/master/supervisord.conf I've found a way that works. |
feea98e
to
7432554
Compare
This is ready for review:
Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for making this work! I have a few comments, but generally I'm fine with these changes if Chocobozzz is too 😄
# Configure Janitor for PeerTube. | ||
ADD janitor.json /home/user/ | ||
RUN sudo chown user:user /home/user/janitor.json | ||
|
||
# Configure and build PeerTube. | ||
RUN yarn install \ | ||
&& npm run build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Why do you no longer pre-build PeerTube?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm run dev
will build the client on the fly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What @Chocobozzz said. Closing.
support/docker/dev/Dockerfile
Outdated
ADD create_user.sql /tmp/ | ||
RUN sudo service postgresql start && \ | ||
sudo -u postgres psql --file=/tmp/create_user.sql && \ | ||
sudo rm /tmp/create_user.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Even if you delete files here, they'll remain part of the image history, since they were ADD
ed above. I suggest leaving this file somewhere useful, or running these steps with inline psql commands as opposed to a file.
Also, if this is really necessary to get PeerTube to work, why isn't it in a Makefile
or in the package.json
NPM scripts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: files: well, these are tiny, so I don't seem to care too much ;) I'll just let them in /tmp in this case.
Re: Makefile/package.json docs: it depends a lot on your database install / version; it's more of an external dependency that something mandated by PeerTube, so IMO it makes sense to keep it separate.
support/docker/dev/janitor.json
Outdated
"label": "PeerTube API", | ||
"proxy": "https" | ||
}, | ||
"3000": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super-nit: Please sort ports from smallest to largest (i.e. "3000"
before "9000"
).
support/docker/dev/janitor.json
Outdated
"proxy": "https" | ||
}, | ||
"3000": { | ||
"label": "PeerTube front", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: What about "web app" instead of "front"? I'd find that more explicit/transparent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I wanted to be picky, I'd say the API also uses web technologies and is an app, so it's also a web app ;) But yeah, it probably makes more sense overall :)
"proxy": "https", | ||
"preview": true | ||
} | ||
}, | ||
"scripts": { | ||
"Start PeerTube": "npm start", | ||
"Start PeerTube": "npm run dev", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, why did you need to switch this? What's the difference between npm start
and npm run dev
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm start
just serves the built server and the compiled client files. It's for production, after anpm run build
.
npm run dev
builds the server, run it on port 9000, builds the client on the fly and serves it on port 3000
@@ -0,0 +1,3 @@ | |||
[program:postgresql] | |||
user = user | |||
command = sudo -u postgres /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This command is very long. Why not make it shorter by using user = postgres
like in the supervisor config example you found?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it the way you suggest, it didn't work, I don't have much time digging up why it didn't work, so meh 🤷. Happy to review a follow-up change to this if you're in the mood of making your PR thereafter.
support/docker/dev/Dockerfile
Outdated
sudo rm /tmp/supervisord-extra.conf | ||
|
||
EXPOSE 3000 | ||
EXPOSE 9000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You can expose multiple ports in one instruction like so.
@@ -2,4 +2,4 @@ | |||
|
|||
cd client || exit -1 | |||
|
|||
npm run ng -- server --hmr --host localhost --port 3000 | |||
npm run ng -- server --hmr --host 0.0.0.0 --port 3000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit scary, because you're exposing something to the world that was limited to localhost
before. Could you please explain why this is needed? Is this a development server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not scary, it's only in development mode: note that this just means exposing the dev web server on the Docker network interface, which is needed if we want to expose the service outside of the container. Keeping it this way (the risk seems nonexistent to me).
support/docker/dev/Dockerfile
Outdated
@@ -15,10 +15,22 @@ WORKDIR /home/user/PeerTube | |||
# Configure Cloud9 IDE to use PeerTube's source directory as workspace (-w). | |||
RUN sudo sed -i "s/-w \/home\/user/-w \/home\/user\/PeerTube/" /etc/supervisord.conf | |||
|
|||
# Install dependencies. | |||
RUN yarn install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUN yarn install --pure-lockfile
Thanks for the reviews, @Chocobozzz @jankeromnes ! Mind to have another look, please? (this works on my machine; since the basic configuration works, and we still have no guarantees that absolute links will work in Janitor anyways, I'd like to not invest too much time on this) |
Seems good for me. Waiting @jankeromnes validation. Even if it does not work yet, we can merge and fix it in another PR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks a lot for the great work! 🎉 🥇 💯
I can't wait to try this out in Janitor! 😄
PeerTube pre-build was removed in Chocobozzz#207 but is still valuable.
PeerTube pre-build was removed in #207 but is still valuable.
Hey @jankeromnes, can you help me please? It's almost working, but I couldn't find out how to start the postgresql daemon from supervisord. Any idea here?
edit: starting from supervisord as I did doesn't work, for some reason (?).