{"id":17683213,"url":"https://github.com/nemanjam/dokku-nextjs-hello-world","last_synced_at":"2025-03-30T19:49:01.865Z","repository":{"id":102334557,"uuid":"604544373","full_name":"nemanjam/dokku-nextjs-hello-world","owner":"nemanjam","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-24T22:14:55.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T22:46:20.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nemanjam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-21T09:33:27.000Z","updated_at":"2023-02-24T20:19:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"41c6b5fb-6fc2-4d11-a5b0-24c387092a08","html_url":"https://github.com/nemanjam/dokku-nextjs-hello-world","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Fdokku-nextjs-hello-world","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Fdokku-nextjs-hello-world/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Fdokku-nextjs-hello-world/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemanjam%2Fdokku-nextjs-hello-world/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemanjam","download_url":"https://codeload.github.com/nemanjam/dokku-nextjs-hello-world/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246372501,"owners_count":20766627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T09:44:40.805Z","updated_at":"2025-03-30T19:49:01.847Z","avatar_url":"https://github.com/nemanjam.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js Dokku demo\n\n```bash\n# on server (in dokku container)\n# https://nextjs-blank-dokku.dokku.arm1.localhost3002.live\ndocker exec -it dokku bash dokku apps:create nextjs-blank-dokku\n\n# add remote (in local app git repo)\ngit remote add dokku dokku@dokku.arm1.localhost3002.live:nextjs-blank-dokku\ngit push dokku main:master\n```\n\n#### Install pack on host\n\n```bash\n(curl -sSL \"https://github.com/buildpacks/pack/releases/download/v0.28.0/pack-v0.28.0-linux-arm64.tgz\" | sudo tar -C /usr/local/bin/ --no-same-owner -xzv pack)\n\ndocker exec -it dokku bash dokku buildpacks:report\n\n# trust builder\npack trust-builder gliderlabs/herokuish:latest-20\n\n# list trusted\npack builder suggest\npack builder inspect \u003cbuilder-image\u003e\npack buildpack inspect gliderlabs/herokuish:latest-20\n\n# list supported architectures\ndocker manifest inspect gliderlabs/herokuish:latest-20\n\ndocker exec -it dokku bash dokku buildpacks:add nextjs-blank-dokku https://github.com/paketo-buildpacks/nodejs.git\n\n# allow arm64\ndocker exec -it dokku bash dokku builder-herokuish:set nextjs-blank-dokku allowed true\n# taj\ndocker exec -it dokku bash dokku builder-herokuish:set --global allowed true\n\ndocker exec -it dokku bash dokku config:show nextjs-blank-dokku\n\ndocker exec -it dokku bash dokku ps:report\n\n# https://oscarchou.com/posts/handbook/dokku-command-cheatsheet/\ndocker exec -it dokku bash dokku config:set nextjs-blank-dokku DOKKU_PROXY_PORT=\"80\" DOKKU_PROXY_PORT_MAP=\"http:80:3000\"\n\n```\n\n```bash\n# git remote -v\ndokku dokku@dokku.arm1.localhost3002.live:nextjs-blank-dokku\n\ndocker exec -it dokku bash dokku apps:list\nnextjs-blank-dokku\n\n# important, delete bind mount data\n# must add ssh key again\nsudo rm -rf ~/traefik-proxy/apps/dokku/dokku-data/*\n\ndocker exec -it dokku bash dokku apps:create nextjs-blank-dokku\n\ngit push dokku main:master\n\nssh-keygen -f \"/home/username/.ssh/known_hosts\" -R \"[dokku.arm1.localhost3002.live]:3022\"\n\n```\n\n### Main error\n\n\n```bash\nusername@computer:~/Desktop/nextjs-blank-dokku$ git push dokku main:master\nEnumerating objects: 44, done.\nCounting objects: 100% (44/44), done.\nDelta compression using up to 8 threads\nCompressing objects: 100% (39/39), done.\nWriting objects: 100% (44/44), 56.72 KiB | 2.47 MiB/s, done.\nTotal 44 (delta 12), reused 0 (delta 0), pack-reused 0\nremote:  !     Herokuish builder not supported on arm64 servers.\nremote:  !     Switching to pack builder.\n-----\u003e Cleaning up...\n-----\u003e Building nextjs-blank-dokku from cnb stack heroku/buildpacks (experimental)...\nlatest: Pulling from heroku/buildpacks\nDigest: sha256:149ba2eceb2f3aba18328ea5fdc15a245952cd28b083f3cdd3ff8d19f37170fa\nStatus: Image is up to date for heroku/buildpacks:latest\n20-cnb: Pulling from heroku/heroku\nDigest: sha256:5b8bfd56b2862648234ac7b9528e407827d9e0f42748910e16b05b9dd03ec0d7\nStatus: Image is up to date for heroku/heroku:20-cnb\n0.16.0: Pulling from buildpacksio/lifecycle\nDigest: sha256:f75a04887fced3ae0504a37edb2c0d29d366511cd9ede34dbb90c5282b106e79\nStatus: Image is up to date for buildpacksio/lifecycle:0.16.0\n===\u003e ANALYZING\nremote: [analyzer] exec /cnb/lifecycle/analyzer: exec format error\nremote: ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 1\nremote:  !     Removing invalid image tag dokku/nextjs-blank-dokku:latest\nremote:  !     App build failed\nTo dokku.arm1.localhost3002.live:nextjs-blank-dokku\n ! [remote rejected] main -\u003e master (pre-receive hook declined)\nerror: failed to push some refs to 'dokku.arm1.localhost3002.live:nextjs-blank-dokku'\n```\n\n```bash\n# 23. feb\n// u app src\n// pack builder suggest\nubuntu@arm1:~/traefik-proxy/apps/mern-boilerplate$ pack builder suggest\nSuggested builders:\nGoogle:                gcr.io/buildpacks/builder:v1      \nHeroku:                heroku/builder:22\nHeroku:                heroku/buildpacks:20\nPaketo Buildpacks:     paketobuildpacks/builder:base\nPaketo Buildpacks:     paketobuildpacks/builder:full\nPaketo Buildpacks:     paketobuildpacks/builder:tiny \n---\n// you are using a pack builder that doesnt work on arm64\n-----\ndocker exec -it dokku bash dokku buildpacks:set nextjs-blank-dokku https://github.com/heroku/heroku-buildpack-nodejs.git\n\ndocker exec -it dokku bash dokku buildpacks:report\nBuildpacks computed stack:     gliderlabs/herokuish:latest-20\n\n```\n\n```bash\ndocker exec -it dokku bash dokku buildpacks:remove nextjs-blank-dokku https://github.com/heroku/heroku-buildpack-nodejs.git\n\nhttps://dev.to/emdienn/deploy-sveltekit-on-dokku-in-8-sort-of-easy-steps-28g2\n\ndocker exec -it dokku bash dokku buildpacks:set-property --global stack paketobuildpacks/builder:base\n\ndocker exec -it dokku bash dokku buildpacks:set-property --global stack heroku/builder:22\n\n\n\n# unset globally\nhttps://dokku.com/docs~v0.25.7/deployment/builders/herokuish-buildpacks/#removing-a-buildpack\n\n\n# set globally\ndokku buildpacks:set-property --global stack gliderlabs/herokuish:latest\n\n# unset globally\ndocker exec -it dokku bash dokku buildpacks:set-property --global stack\n```\n\n### Solution\n\n```ts\n// can use main, no need for master\ngit push dokku main:main\n\n// can use default\ngliderlabs/herokuish:latest\n\n// solves all arm64 dependencies, postgres, node.js...\nhttps://featurist.co.uk/blog/hosting-rails-apps-for-free-on-oracle-cloud-with-dokku\nhttps://www.reddit.com/r/docker/comments/ray2wc/comment/hnluex8\nhttps://stackoverflow.com/questions/67017795/npm-install-is-failing-with-docker-buildx-linux-arm64\nhttps://github.com/tonistiigi/binfmt\nhttps://hub.docker.com/r/tonistiigi/binfmt\n\n// this line, container installs and configures the host\ndocker run --privileged --rm tonistiigi/binfmt --install all\n\n// todo:\nrouting and https fails, add dokku config\n\n```\n\n### Fix routing\n\ndocker exec -it dokku bash dokku domains:report --global\n\ndocker exec -it dokku bash dokku domains:report nextjs-blank-dokku\n\ndocker exec -it dokku bash dokku proxy:ports nextjs-blank-dokku\n\n### Check if app container is running, not only Dokku container - Process Management\n\ndocker exec -it dokku bash dokku ps:start nextjs-blank-dokku\n\n#### Rebuild\n\ndocker exec -it dokku bash dokku ps:rebuild nextjs-blank-dokku\n\n### Lets encrypt https\n\nthis is plugin, not dokku config\n\nhttps://github.com/dokku/dokku-letsencrypt\n\ndocker exec -it dokku bash dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git\ndocker exec -it dokku bash dokku config:set --no-restart nextjs-blank-dokku DOKKU_LETSENCRYPT_EMAIL=acczasearchapi@gmail.com\n\ndocker exec -it dokku bash dokku letsencrypt:set nextjs-blank-dokku acczasearchapi@gmail.com\n\ndocker exec -it dokku bash dokku letsencrypt:enable nextjs-blank-dokku acczasearchapi@gmail.com\n\n---\n---\n\n# After solved network error\n\n### Add remote, create app and push\n\n```bash\ngit remote add dokku dokku@dokku.arm1.localhost3002.live:nextjs-app\n\ndokku apps:create nextjs-app\n\ndokku apps:list\n\n# check if added\ndokku network:report node-app\n\ngit push dokku main:main\n```\n\nTraefik wont request cert for http app route\n\n```bash\nubuntu@arm1:~/traefik-proxy/core$ curl https://node-app.dokku.arm1.localhost3002.live/\ncurl: (35) error:0A000126:SSL routines::unexpected eof while reading\n```\n\nTraefik has passthrough, Dokku must handle ssl\n\n```\nError while dialing backend: dial tcp 172.21.0.4:443: connect: connection refused\"\n```\n\ncurl http://nextjs-app.dokku.arm1.localhost3002.live\ncurl https://nextjs-app.dokku.arm1.localhost3002.live\n\n### Solve let Dokku http through Traefik https\n\nhttps://dokku.com/docs/networking/proxies/nginx/#hsts-header\n\n```bash\nusername@computer3:~/Desktop/dokku-nextjs-hello-world$ curl https://nextjs-app.dokku.arm1.localhost3002.live\ncurl: (35) error:0A000126:SSL routines::unexpected eof while reading\n\ndokku nginx:set --global hsts false\n\ndokku ps:stop nextjs-blank-dokku\ndokku ps:start nextjs-blank-dokku\n```\n\n### Lets encrypt\n\nhttps://github.com/dokku/dokku-letsencrypt\n\ndokku letsencrypt:set --global email your@email.tld\n\ndokku letsencrypt:enable nextjs-app\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemanjam%2Fdokku-nextjs-hello-world","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemanjam%2Fdokku-nextjs-hello-world","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemanjam%2Fdokku-nextjs-hello-world/lists"}