dokku-community / dokku-apt Goto Github PK
View Code? Open in Web Editor NEWInject deb packages into dokku based on files in project
License: MIT License
Inject deb packages into dokku based on files in project
License: MIT License
We are currently unable to deploy updates or fixes to our production server due to a deb error in the build process. This happens whether we are doing a local deployment to the server via git (ssh) or we simply rebuild the app with dokku ps:rebuild app_name.
We have attempted to update apt packages with sudo apt update and then sudo apt upgrade. This did not resolve the issue.
The error displayed is reproduced below:
Reading package lists...
W: http://apt.postgresql.org/pub/repos/apt/dists/jammy-pgdg/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
-----> Installing *.deb
dpkg-deb: error: failed to read archive '/cache/apt/cache/archives/*.deb': No such file or directory
! Failure during app build
! Retagging old image fb212186be8d as dokku/mtp-prod:latest
! App build failed
! W: http://apt.postgresql.org/pub/repos/apt/dists/jammy-pgdg/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
dpkg-deb: error: failed to read archive '/cache/apt/cache/archives/*.deb': No such file or directory
! Failure during app build
! Retagging old image fb212186be8d as dokku/app_name:latest
! App build failed
Note that deployment works fine on the same server previously and we made no recent changes to the server.
Replace the deprecated pre-build
hook with the pre-build-buildstep
hook. Maybe handle backward compatibility?
See dokku/dokku#954
I installed the plugin in my remote server:
sudo dokku plugin:list
plugn: 0.3.0
00_dokku-standard 0.12.13 enabled dokku core standard plugin
20_events 0.12.13 enabled dokku core events logging plugin
apps 0.12.13 enabled dokku core apps plugin
apt 0.4.1 enabled Inject deb packages into dokku based on files in project
build-env 0.12.13 enabled dokku core build-env plugin
certs 0.12.13 enabled dokku core certificate management plugin
checks 0.12.13 enabled dokku core checks plugin
common 0.12.13 enabled dokku core common plugin
config 0.12.13 enabled dokku core config plugin
docker-options 0.12.13 enabled dokku core docker-options plugin
domains 0.12.13 enabled dokku core domains plugin
enter 0.12.13 enabled dokku core enter plugin
git 0.12.13 enabled dokku core git plugin
letsencrypt 0.8.8 enabled Automated installation of let's encrypt TLS certificates
logs 0.12.13 enabled dokku core logs plugin
network 0.12.13 enabled dokku core network plugin
nginx-vhosts 0.12.13 enabled dokku core nginx-vhosts plugin
plugin 0.12.13 enabled dokku core plugin plugin
postgres 1.4.11 enabled dokku postgres service plugin
proxy 0.12.13 enabled dokku core proxy plugin
ps 0.12.13 enabled dokku core ps plugin
redis 1.4.10 enabled dokku redis service plugin
repo 0.12.13 enabled dokku core repo plugin
scheduler-docker-local 0.12.13 enabled dokku core scheduler-docker-local plugin
shell 0.12.13 enabled dokku core shell plugin
ssh-keys 0.12.13 enabled dokku core ssh-keys plugin
storage 0.12.13 enabled dokku core storage plugin
tags 0.12.13 enabled dokku core tags plugin
tar 0.12.13 enabled dokku core tar plugin
But when I ran git push dokku master
, I couldn't see this plugin installed packages I added to apt-packages
apt-packages:
software-properties-common
ffmpeg
Deploy logs:
git push dokku master
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 566 bytes | 566.00 KiB/s, done.
Total 4 (delta 2), reused 0 (delta 0)
-----> Cleaning up...
-----> Building animexpress from dockerfile...
-----> Setting config vars
DOKKU_DOCKERFILE_CMD: CMD ["bin/run-dev.sh"]
remote: build context to Docker daemon 6.18MB
Step 1/14 : FROM fongfan999/2.5.3-ruby-jemalloc-node-yarn:latest
---> 7f4af386159c
Step 2/14 : LABEL maintainer="Phong Phan <[email protected]>"
---> Using cache
---> 593490e55187
Step 3/14 : COPY Gemfile* /tmp/
---> Using cache
---> 0b78c30de208
Step 4/14 : COPY package.json /tmp/
---> Using cache
---> 6026a6a58cfd
Step 5/14 : COPY yarn.lock /tmp/
---> Using cache
---> 89e75355c7b5
Step 6/14 : WORKDIR /tmp
---> Using cache
---> 22976134674f
Step 7/14 : RUN bundle install --jobs 20 --retry 5 --without development test
---> Using cache
---> c99bd975518e
Step 8/14 : RUN yarn install
---> Using cache
---> 152206be00fa
Step 9/14 : RUN mkdir /app
---> Using cache
---> f349afbbd90f
Step 10/14 : WORKDIR /app
---> Using cache
---> 8300512c1d19
Step 11/14 : COPY . /app
---> Using cache
---> e7a361f70f94
Step 12/14 : ENV RAILS_ENV production
---> Using cache
---> 554618047ba7
Step 13/14 : ENV RACK_ENV production
---> Using cache
---> 13bdfb5178b0
Step 14/14 : CMD ["bin/run-dev.sh"]
---> Using cache
---> 6e86d11f4836
Successfully built 6e86d11f4836
Successfully tagged dokku/animexpress:latest
-----> Releasing animexpress (dokku/animexpress:latest)...
-----> Deploying animexpress (dokku/animexpress:latest)...
-----> Attempting to run scripts.dokku.predeploy from app.json (if defined)
-----> App Procfile file found (/home/dokku/animexpress/DOKKU_PROCFILE)
-----> DOKKU_SCALE file found (/home/dokku/animexpress/DOKKU_SCALE)
=====> console=0
=====> rake=0
=====> web=1
=====> worker=1
-----> zero downtime is disabled for app (animexpress.console). stopping currently running containers
-----> zero downtime is disabled for app (animexpress.rake). stopping currently running containers
-----> zero downtime is disabled for app (animexpress.web). stopping currently running containers
=====> stopping animexpress.web (aa176a654db8673c5d56a8925b1f767643ff15852040d5b8b010715eccf86e12)
-----> zero downtime is disabled for app (animexpress.worker). stopping currently running containers
=====> stopping animexpress.worker (90a23d04a79dea1641f005b0f3c338b1e8630ca6e061b72b3f2de3d27d4af955)
-----> Running post-deploy
-----> Configuring animexpress.io...(using built-in template)
-----> Creating https nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
-----> Setting config vars
DOKKU_APP_RESTORE: 1
-----> Found previous container(s) (aa176a654db8) named animexpress.web.1
=====> Renaming container (aa176a654db8) animexpress.web.1 to animexpress.web.1.1550347281
=====> Renaming container (5035a722466e) brave_edison4 to animexpress.web.1
-----> Found previous container(s) (90a23d04a79d) named animexpress.worker.1
=====> Renaming container (90a23d04a79d) animexpress.worker.1 to animexpress.worker.1.1550347282
=====> Renaming container (dc10f482958f) eager_ptolemy to animexpress.worker.1
-----> Attempting to run scripts.dokku.postdeploy from app.json (if defined)
=====> Application deployed:
http://animexpress.io
https://animexpress.io
To 167.99.29.90:animexpress
413b5aa..49e1d2a master -> master
Just a few thoughts on making documentation clearer.
Basically, I'm trying to use dokku-apt to run the commands mentioned in script - https://get.docker.com/ubuntu/
It requires repo keys to be imported. Seems dokku-apt doesn't have a way to use repo keys.
I am trying to install nightly rustc
, and using this PPA: ppa:infinity0/rust-nightly
However, with an apt-repository file that reads:
ppa:infinity0/rust-nightly
and an apt-packages file that reads:
rustc
git push dokku master
fails with this error:
remote: E: Unable to locate package rustc
Any ideas?
I'm getting a hash sum error during apt-get update
today, which I haven't gotten before (see below). Let me know if you need more details or how I can get you more debugging information.
-----> Injecting apt repositories and packages ...
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:3 http://apt.postgresql.org trusty-pgdg InRelease [30.1 kB]
Get:4 http://archive.ubuntu.com trusty Release.gpg [933 B]
Get:5 http://archive.ubuntu.com trusty Release [58.5 kB]
Get:6 http://archive.ubuntu.com trusty-security/main amd64 Packages [550 kB]
Get:7 http://archive.ubuntu.com trusty-updates/main amd64 Packages [918 kB]
Get:8 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]
Get:9 http://apt.postgresql.org trusty-pgdg/main amd64 Packages [94.6 kB]
Get:10 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]
remote: W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages Hash Sum mismatch
remote:
remote: E: Some index files failed to download. They have been ignored, or old ones used instead.
Fetched 11.1 MB in 51s (217 kB/s)
To [email protected]:myapp
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp'
How do I specify a specific version of a package?
Hello, I came across your project while implementing deployment with dokku. I'm not clear on how dokku-apt should be used to install Chrome in my Ubuntu image, so I'd like to clarify. Any pointer would be appreciated.
Environment info:
Ubuntu 20.04.1 LTS
Dokku 0.21.4
Rails 6
The Rails app uses webdrivers
and watir
(a gem built on top of Selenium) to open a web page and read its content, so a browser executable needs to be installed, in this case it is expected to be Chrome.
This is what I have tried: added these files in the root folder of my Rails app (i.e. same level as app, config, etc.): apt-keys
, apt-repositories
, apt-packages
. And here are the contents of each of the 3 files:
https://dl-ssl.google.com/linux/linux_signing_key.pub
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
google-chrome-stable
But it threw the following error when I deploy (through git push dokku master
):
Package google-chrome-stable is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source
Then I tried renaming the apt-repositories file to apt-sources-list
, with the same content, then deployed again. This time it threw this error:
remote: W: GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 78BD65473CB3BD13
remote: E: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
Could you advise how dokku-apt should be used to install Chrome?
Also, as a suggestion, I think it'd be more illustrative if the README.md showed a working example with all the files needed (e.g. install Chrome or another package) instead of / in addition to the current code snippets for the apt-* files that are independent of each other. Basically, an example that shows how the apt-* files would work together in an actual scenario rather than how each individual file should be written.
Appreciate your time. Please advise.
I'm trying to inject the PHP agent (or any other agent) of new relic inside the containers for better visibility inside my project usage.
I see that I can specify the needed app name and license key using debconf by adding the following code to the apt-debconf file
newrelic-php5 newrelic-php5/application-name string "My App Name"
newrelic-php5 newrelic-php5/license-key string "YOUR_LICENSE_KEY"
But this way, I'll have to hard code my license key and app name inside the git repository.
Can I use the dokku configs assigned to the app instead of hard coding the values?
This way I could use the same git repo for similar projects (for WordPress site for example)
Hi! The dokku-apt
project is a really nice plugin, and a ton of Dokku users install it in their setup. I'd love to be able to transfer the project to the dokku-community org so that we can give it a bit more love and support :)
Thoughts on this? We would give anyone from the F4-group complete access to the code if you wish to continue maintaining it as well :)
Hi,
I used dokku-update
and was a little bit confused that dokku-apt
uses the old application image.
How I have recognized that? I saw the following message while dokku-update
has rebuild my app:
-----> Compatible extended app image found, skipping system package installation
I updated from
dokku:0.29.4
to dokku:0.30.2
herokuish:0.5.40
to herokuish:0.5.41
My apt-packages
file didn't change and it seems that dokku-apt
only considers it's own files for the CONTENT_SHA
.
dokku-apt/builder-create-dokku-image
Line 27 in 3d611d3
Line 22 in 236a972
Is it on purpose, that I have to use docker
to delete the cache image manually... or can you suggest a better solution for that issue?
Is dokku-apt works with dokku version 0.12.13?
I can't see "-----> Injecting apt repositories and packages ..." in my log
sudo dokku plugin:list
plugn: 0.3.0
00_dokku-standard 0.12.13 enabled dokku core standard plugin
20_events 0.12.13 enabled dokku core events logging plugin
apps 0.12.13 enabled dokku core apps plugin
apt 0.4.1 enabled Inject deb packages into dokku based on files in project
build-env 0.12.13 enabled dokku core build-env plugin
certs 0.12.13 enabled dokku core certificate management plugin
checks 0.12.13 enabled dokku core checks plugin
common 0.12.13 enabled dokku core common plugin
config 0.12.13 enabled dokku core config plugin
docker-options 0.12.13 enabled dokku core docker-options plugin
domains 0.12.13 enabled dokku core domains plugin
enter 0.12.13 enabled dokku core enter plugin
git 0.12.13 enabled dokku core git plugin
letsencrypt 0.8.8 enabled Automated installation of let's encrypt TLS certificates
logs 0.12.13 enabled dokku core logs plugin
network 0.12.13 enabled dokku core network plugin
nginx-vhosts 0.12.13 enabled dokku core nginx-vhosts plugin
plugin 0.12.13 enabled dokku core plugin plugin
proxy 0.12.13 enabled dokku core proxy plugin
ps 0.12.13 enabled dokku core ps plugin
repo 0.12.13 enabled dokku core repo plugin
scheduler-docker-local 0.12.13 enabled dokku core scheduler-docker-local plugin
shell 0.12.13 enabled dokku core shell plugin
ssh-keys 0.12.13 enabled dokku core ssh-keys plugin
storage 0.12.13 enabled dokku core storage plugin
tags 0.12.13 enabled dokku core tags plugin
tar 0.12.13 enabled dokku core tar plugin
I installed the plugin in my remote server:
sudo dokku plugin:list
plugn: 0.3.0
00_dokku-standard 0.12.13 enabled dokku core standard plugin
20_events 0.12.13 enabled dokku core events logging plugin
apps 0.12.13 enabled dokku core apps plugin
apt 0.4.1 enabled Inject deb packages into dokku based on files in project
build-env 0.12.13 enabled dokku core build-env plugin
certs 0.12.13 enabled dokku core certificate management plugin
checks 0.12.13 enabled dokku core checks plugin
common 0.12.13 enabled dokku core common plugin
config 0.12.13 enabled dokku core config plugin
docker-options 0.12.13 enabled dokku core docker-options plugin
domains 0.12.13 enabled dokku core domains plugin
enter 0.12.13 enabled dokku core enter plugin
git 0.12.13 enabled dokku core git plugin
letsencrypt 0.8.8 enabled Automated installation of let's encrypt TLS certificates
logs 0.12.13 enabled dokku core logs plugin
network 0.12.13 enabled dokku core network plugin
nginx-vhosts 0.12.13 enabled dokku core nginx-vhosts plugin
plugin 0.12.13 enabled dokku core plugin plugin
postgres 1.4.11 enabled dokku postgres service plugin
proxy 0.12.13 enabled dokku core proxy plugin
ps 0.12.13 enabled dokku core ps plugin
redis 1.4.10 enabled dokku redis service plugin
repo 0.12.13 enabled dokku core repo plugin
scheduler-docker-local 0.12.13 enabled dokku core scheduler-docker-local plugin
shell 0.12.13 enabled dokku core shell plugin
ssh-keys 0.12.13 enabled dokku core ssh-keys plugin
storage 0.12.13 enabled dokku core storage plugin
tags 0.12.13 enabled dokku core tags plugin
tar 0.12.13 enabled dokku core tar plugin
I installed the dokku-apt plugin in /var/lib/dokku/plugins, then in: /home/dokku/MY_APP, I added a file "apt-packages" with one line: phantomjs. I then re-deployed my app. It now does not appear that phantomjs is installed, as typing: phantomjs --version urges me to install it and when I launch a rails console, the gem indicates phantomjs is not installed.
Am I misunderstanding something? Did I do something wrong? Any help would be much appreciated.
Thanks!
I am new to Dokker and Dokku. My Rails application requires several packages including java-7-jdk. When app re-deploy, all the packages installs again, deploy -> again installs all packages. So it should be? Docker not saves state?
I've got a node app which deploys fine to my staging server, but fails when deploying to my production server.
Staging is running dokku v0.22.9
Production is running dokku v0.25.1
I turned on tracemode and looked through both the staging logs and the production logs.
I've found that the failure occurs here, where dokku sees 6 restarts in my docker container.
Waiting for 10 seconds ...
remote: + is_container_status ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311 Running
remote: + declare 'desc=return 0 if given docker container id is in given state'
remote: + local CID=ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
remote: + local 'TEMPLATE={{.State.Running}}'
remote: ++ docker container inspect --format '{{.State.Running}}' ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
remote: + local CONTAINER_STATUS=true
remote: + [[ true == \t\r\u\e ]]
remote: + return 0
remote: ++ docker container inspect --format '{{ .RestartCount }}' ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
remote: + local container_restarts=6
remote: + [[ 6 -ne 0 ]]
remote: + docker container update --restart=no ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
remote: + docker container stop ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
remote: + dokku_log_fail 'App container failed to start!!'
remote: + declare 'desc=log fail formatter'
remote: + echo ' ! App container failed to start!!'
remote: ! App container failed to start!!
remote: + exit 1
remote: + checks_check_deploy_cleanup ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
remote: + declare 'desc=cleans up CHECK_DEPLOY_TMP_WORK_DIR and print container output'
remote: + local id=ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311
remote: + rm -rf /tmp/dokku-29385-trigger-scheduler-docker-local-check-deploy.17BXNo
remote: + [[ -n ef9328b1d5336a5ebd84eb38413aabe7f235557d8cb1c21af385f0071195a311 ]]
remote: + dokku_log_info2_quiet 'myApp web container output:'
remote: + declare 'desc=log info2 formatter (with quiet option)'
remote: + [[ -z '' ]]
remote: + echo '=====> myApp web container output:'
I looked through my changes to see what I might have added to cause the failure and was able to narrow it down to the inclusion of this plugin.
When I rename my apt-packages
file, the deployment works fine to my production server.
So I suppose I mostly just have 2 questions.
1: Any bells ringing around why the exact same code would push fine to my staging server, but fail on my production server? The differing dokku versions is the most obvious difference I can think of. Could it be a memory issue on the production server?
2: Where in the huge debug output could I look for maybe a bit more info on why my container is restarting 6 times? I tried searching for exit status 1
, but I'm not seeing anything stand out when I do that.
I'm going to try upgrading my staging server to the same version of dokku running on production (I didn't realize these were running different versions) and see if that makes a difference.
If i can't get anywhere, I could sanitize my log output of sensitive info and post that, but I thought I see if anyone had any thoughts as to what might be going on before doing that.
Thanks.
apt-get no longer works in dokku 0.4.0. Any ideas on how to make this plugin 0.4.0 compatible?
Pretty please :)
In many cases, recommended packages are not needed in a container.
For example, I have the texlive/latex distribution in one of my project but I have to wait every time for apt to download documentation packages.
For example, I think you should implement something like a apt-config file that would then be copied in /etc/apt/preferences.d/90dokku-customizations
.
For example, in my case the content would be:
APT {
Install-Recommends "false";
}
Thanks for your attention.
I have created a file called apt-repositories
in the root of my project, with this content:
ppa:ubuntu-toolchain-r/test
There is a new line at then end of the file.
On pushing to dock, it seems to be added fine, but fails with the last line being Error: '' invalid
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
remote: gpg: keyring `/tmp/tmp51y68o64/secring.gpg' created
remote: gpg: keyring `/tmp/tmp51y68o64/pubring.gpg' created
remote: gpg: requesting key BA9EF27F from hkp server keyserver.ubuntu.com
remote: gpg: /tmp/tmp51y68o64/trustdb.gpg: trustdb created
remote: gpg: key BA9EF27F: public key "Launchpad Toolchain builds" imported
remote: gpg: Total number processed: 1
remote: gpg: imported: 1 (RSA: 1)
OK
Error: '' invalid
Any ideas?
So doing this manually seems to work:
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.19.0-59-generic x86_64)
ben@box1:~$ export DEBIAN_FRONTEND=noninteractive
ben@box1:~$ sudo apt-get update
Ign http://us-central1.gce.archive.ubuntu.com trusty InRelease
[...]
Fetched 3,412 kB in 3s (919 kB/s)
Reading package lists... Done
ben@box1:~$ sudo apt-get install -y software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
ben@box1:~$ sudo add-apt-repository -y "ppa:ubuntu-toolchain-r/test"
gpg: keyring `/tmp/tmpg5ojrsa9/secring.gpg' created
gpg: keyring `/tmp/tmpg5ojrsa9/pubring.gpg' created
gpg: requesting key BA9EF27F from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpg5ojrsa9/trustdb.gpg: trustdb created
gpg: key BA9EF27F: public key "Launchpad Toolchain builds" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
ben@box1:~$
I cannot find any trace about this error string in this project. Might be coming from dokku/docker directly?
At the moment, packages are installed in lexicographical order. This is a bad experience for users that don't know their dependency tree, only that certain packages must be installed.
We should instead do this:
I don't know if this is actually possible in a dokku plugin, but it would be nice if dokku-apt didn't have to reinstall every package every time you push to dokku.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.