Anders (izzno / gooood) πŸ‡³πŸ‡΄
There's plenty of guides / tuto / books on how to develop with django but very litle on how to setup a dev/prod evviroment where you can push code and update existing running services. I want to set up an environment where we can deploy changes and or / run a developer versioni all on the same DB, what are the reccomendations around this. to have 2 dockerfiles, one for production and one for development is easy enough but wht/how do you update / develop on an existin gproduct?
Anders (izzno / gooood) πŸ‡³πŸ‡΄
use heroku
Our code/db will never leave the house so thats not an option.
Rajjix
I don’t think it’s a good idea to have same database for both versions, that said i’m no where near publishing a scalable web app, but here are my 2 cents 💰 I usually run 2 different servers on same vps one for production usually nginx and another for development usually apache2 servers are not hard to setup just some configuration stuff, that is to have the same domain work on both serves just different ports they are pretty easy to configure and in case of ssh better to change the port and use rsa instead of password.
Anders (izzno / gooood) πŸ‡³πŸ‡΄
I was thinking more in line of docker, Ill wrap the environments in docker then I dont need the "same" db as I can spin up another instance of it making it "the same" but not. But the automatic push β€”> deploy solution is the ones I miss more totu / information around.
Anders (izzno / gooood) πŸ‡³πŸ‡΄
More like what happens if I generate new fields and models on the dev side, how do i migrate these changes to an active running app? Do I have to do it again in the excact same order ?
Anders (izzno / gooood) πŸ‡³πŸ‡΄
I could add the migrate commands to the docker-build fiile so this happens every time the image rebuilds, but again. Whats the common practice / "right" way to do things.
Rajjix
i haven’t use docker, i’m sure u’re smart enough to figure it out and keep us posted on what you’ve decided on doing
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Sure 👍, if you are unfamilliar with docker i urge you to learn it! It won't take you long and is VERY usefull in many situations.
Rajjix
It’s on my to learn list, just need time
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Anonymous
How do I add extra paths from this base_dir? BASE_DIR = Path(file ).Resolves ().Parent.parent.parent I've copied this code but I do not know very well how it works, for staic I used BASE_DIR / 'static', but I want to add other extra directories, I tried BASE_DIR / 'dir1' / 'dir2' and BASE_DIR / 'dir1/dir2' but I think that did not work
Mirco
I was thinking more in line of docker, Ill wrap the environments in docker then I dont need the "same" db as I can spin up another instance of it making it "the same" but not. But the automatic push β€”> deploy solution is the ones I miss more totu / information around.
One idea could be to set a git hook so everytime you push your stable branch, it rebuilds everything with new code Or use some CI/CD platform so you always have tested code and build it only if it passes all of your tests But I still don't have so much experience I strongly believe suggests from @JimmySan are like gold 💪😎
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Who's that?
Anonymous
and how do I configure django to use the static root directory locally? I only get static dirs and using --insecure, but that way I have to restart the server every time I make some changes
Jimmies San
i not use docker on production btw. only on dev stage
Jimmies San
then with a ci/cd pipeline i deploy all update in different stage before production
Jimmies San
to avoid disruptive update
Rajjix
then with a ci/cd pipeline i deploy all update in different stage before production
what a long road separating me from becoming pro 🤷‍♂️
Jimmies San
what a long road separating me from becoming pro 🤷‍♂️
DTAP . d on docker. TAP on live stage. TA automatic. P manual
Jimmies San
😊
Mirco
If I well remember, some of old collegues used to write automatically deploy using Ansible and Makefile to speed up process so make dev, make beta and make prod etc.
Jimmies San
yep. or fabric
Jimmies San
or terraform
Jimmies San
it depends from infra
Rohan
Teach us senpai
Rajjix
please stop βœ‹
Rajjix
overwhelmed bar has reached its maximum
DevilAstra
Is it sensible to use vagrant and virtual box to deploy our server?
Anders (izzno / gooood) πŸ‡³πŸ‡΄
I would say no
Anders (izzno / gooood) πŸ‡³πŸ‡΄
I would not run Virtual Box in production.
Anders (izzno / gooood) πŸ‡³πŸ‡΄
unless you mean "a" virtual box...
Anders (izzno / gooood) πŸ‡³πŸ‡΄
My job upuntil a year ago was a typical multisystem admin, så the admin part is not the problem. Its the CI/CD platform I need to learn. But like you said it depends on the project, and this project will always have the possibility of downtime for upgrades etc without a problem. At least for the unforseeable future.... So docker in production is a real option....
Anders (izzno / gooood) πŸ‡³πŸ‡΄
I run almost every service in docker. Either with Docker-compose or Docker-machine.
Anders (izzno / gooood) πŸ‡³πŸ‡΄
You have other tools like portainer that can help to but I like to keep it in the CLI
Mirco
Me too 😀
Anders (izzno / gooood) πŸ‡³πŸ‡΄
😁
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Yes.
Jimmies San
have you stresstested your application with or without docker?
Anders (izzno / gooood) πŸ‡³πŸ‡΄
With, these are low traffic services, internal systems etx
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Etc
Jimmies San
aaah ok
Jimmies San
'cause with docker i have bad performance
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Like phpipam, intranet pages etc
Jimmies San
with cri-o on kubernetes all good, docker with compose or not: a mess :(
Anders (izzno / gooood) πŸ‡³πŸ‡΄
'cause with docker i have bad performance
Then it can be your storage layer
Anders (izzno / gooood) πŸ‡³πŸ‡΄
What system do you run Docker on?
Jimmies San
i don't think so... the databse is outside docker, clustered, and the files are saved on S3-compatible space
Jimmies San
the service are api, i see a lot of issue on the network part too
Anders (izzno / gooood) πŸ‡³πŸ‡΄
You save files outside the container?
Jimmies San
the container are ephemeral: can die every moment
Anders (izzno / gooood) πŸ‡³πŸ‡΄
What kind of files?
Jimmies San
like user uploads
Jimmies San
pdf, img, blabla
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Ah yes
Jimmies San
inside the docker only the sourcecode
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Jimmies San
What?
evanescent
Jimmies San
can die in every moment
Jimmies San
it's not a virtualmachine
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Not, thats why you should have access to the full resources of the machine and I think its very strange you have issues
Anders (izzno / gooood) πŸ‡³πŸ‡΄
I shares kernelspace with the local system... But whats your OS (you tried docker on in production)
Jimmies San
centos
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Well that sucks...
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Its "no" secret Docker and CentOS have issues.
Jimmies San
🤣🤣🤣
Anders (izzno / gooood) πŸ‡³πŸ‡΄
(doesnt suck for everything) hehe
Jimmies San
are you serious?
Anders (izzno / gooood) πŸ‡³πŸ‡΄
very
Jimmies San
😂🤣🤣🤣🤣🤣
Anders (izzno / gooood) πŸ‡³πŸ‡΄
Check out ubuntu and fedora, I would use Ubuntu