Giter Site home page Giter Site logo

Comments (6)

Jarrodsz avatar Jarrodsz commented on May 20, 2024

Update, i found only the pnpm deploy command that generates a new clean working directory of a mono repro package.
Almost got it to work but not totally..

I wrote this bash script:
https://gist.github.com/Jarrodsz/2440a6bff5eec9cbd8aec93720c9bc38

That creates a new folder _deploy/my_app and then puts all mono repro code in it, i remove the dev dependencies and do a pnpm install for the @core packages im using.

The only problems is that

    "@core/core": "workspace:*",
    "@core/ui": "workspace:*",

Is still in my package.json.
It feels like im re-inventing the wheel a bit but since im using dokku and it expects the code in a certain format i don't know if there is a better way.

I now think i could scan my package.json for any "@core/core": "workspace:*", entries remove those and install the packages from the deploy directory manually running pnpm install @core/core instead. I assume that way they will be installed in that local deploy folder for the project.

BTW I create a new git init and add the git remote for dokku on each time the deploy command is run, i also make sure before to remove the whole ./deploy/$app_name path.

What do you think?

from remix-gospel-stack.

PhilDL avatar PhilDL commented on May 20, 2024

Hi, sorry but I am a bit lost, I never used Dokku and assumed it was a using standard Docker images. Some general advice:

  • You shouldn't mix npm and pnpm in your Dockerfile, if you have a problem with the way pnpm installs dependencies you could add a .npmrc at the root of the project with:
prefer-workspace-packages=true
node-linker=hoisted
strict-peer-dependencies=false
auto-install-peers = true
  • I insist but every command should be run from the root of the folder.
  • If a command target a specific app in the monorepo you should use --filter=@org/nameofthepackage
  • If you move around deps, your pnpm lock file could be out of sync, to fix that, from the root of your monorepo run pnpm i --fix-lockfile
  • Turbo repo helps you build folder structure for Docker and correct package.json for the target app with turbo prune --scope=@remix-gospel-stack/remix-app --docker notice the --docker flag.
  • I feel that you are reinventing the wheel yes, the tools like pnpm and turborepo should actually help you.
  • If you feel that you begin to do too much outlandish stuff I would suggest you to recreate a simple monorepo that works with Dokku (if that's what you want), a simple empty Remix app, and just 1 package. Then slowly add complexity and see what the blocking points are, eventually, you would copy-paste every other packages you have in your repo and see when it begins to break.

Cannot help you more without looking into the whole project and trying for myself sorry!

from remix-gospel-stack.

Jarrodsz avatar Jarrodsz commented on May 20, 2024

I got as far as

Get the name of the application from the command line argument.

app_name=$1

Check if the application exists.

app_dir=$(find ./apps/* -type d -name "$app_name" -print0 | xargs -0 ls)
if [ -z "$app_dir" ]; then
echo "App '$app_name' does not exist"
exit 1
fi

Check if the second argument is "test" and modify the output accordingly.

if [ "$2" = "test" ]; then
echo "Deploying test locally from apps/$app_name"
docker buildx build -t ${app_name} -f "apps/${app_name}/Dockerfile" .
else
echo "Deploying Production $app_name from apps/$app_name"
cd apps/$app_name
git add *
git commit -m 'deploy'
git push dokku master
fi```

The local test deployment works with this but requires each app to be faultless while one might be developing or refactoring code your unable go deploy or have to move in progress app out of /apps trmoporarily.

The dokku deployment still doesent work since it does not have access to local packages this way.

had a short break but already wasted another day on this not much feedback online so i probably end up dropping mono repro all together after spending lotts of time on it.

maybe you have some final thoughts on how i could make it work wirh dokku?

its just undeployable and the problem
Is pnpm turbo mono repro i feel so pissedoff wasting so much time on this and still not have been able to solve itπŸ₯²

from remix-gospel-stack.

Jarrodsz avatar Jarrodsz commented on May 20, 2024

Full details here
vercel/turbo#5635

I posted this on turbo discord pnpm discord and renkx discord 10
Days ago but nobody seems to use dokku or seems to care so then the only option would be to drop turbo mono repro wirh pnpm, so sad if works awsome locally for most parts

from remix-gospel-stack.

PhilDL avatar PhilDL commented on May 20, 2024

I understand your frustration but it's really hard to help you without seeing the full code, environment, etc... that I could pull and run locally.

Let's put dokku out of the equation for a moment, can you confirm that building AND running the Dockerfile locally works?
I mean running local commands that are similar to that (switching for your database, and your docker network)

docker build -t remix-gospel-stack-remix-app -f ./apps/remix-app/Dockerfile .
docker run -it --init --rm -p 3000:3000 --env-file .env.docker --env DATABASE_URL='postgresql://postgres:postgres@db:5432/postgres' --network=app_network remix-gospel-stack-remix-app

The app must be running and accessible through localhost:3000 locally when you docker run.

from remix-gospel-stack.

Jarrodsz avatar Jarrodsz commented on May 20, 2024

I fixed this in the end sorry my excuse for never posting back lost track.

the solution was to deploy on a per app base the mino repro docs where misleading and putt me of guard. So what i do for dokku is have a seperate git for each alpp with a dockerfile and just do a git push remote. Which deploys the app.

will post a example config tomorrow.
Out of my head i just import the packages in the dockerfile so it does not break on them not be available from the single app perspective

from remix-gospel-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.