I am following the Reduce your CI cost using Docker to run local tests article and managed to run my tests inside a Ubuntu docker container. However, I have one test which fails after about 10 minutes of running. Here is the error I see:
# flutter test test/lib/mobile/services/sync/sync_service_test.dart
12:25 +0 -1: apiSync It should throw an exception if the sync fails [E]
TimeoutException after 0:10:00.000000: Test timed out after 10 minutes.
dart:isolate _RawReceivePortImpl._handleMessage
However, this test runs fine in macOS (my machine and in Bitrise CI).
To help resolve this issue, I am trying to find a way to debug this test. Is there a way I can remotely debug a test running inside this Docker container?
This is a copy of my modified Dockerfile:
# Need to match the version of Linux your CI is running on
FROM ubuntu:20.04
# Prerequisites
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
RUN apt update && apt install -y curl git unzip xz-utils zip libglu1-mesa openjdk-8-jdk wget libsqlite3-dev
WORKDIR /home/developer
# Download Flutter SDK
ARG flutter_version
RUN git clone https://github.com/flutter/flutter.git -b ${flutter_version}
ENV PATH "$PATH:/home/developer/flutter/bin"
COPY pubspec.* /home/developer/project/
WORKDIR /home/developer/project
RUN flutter pub get
COPY *.yaml *.json /home/developer/project/
COPY android /home/developer/project/android
COPY assets /home/developer/project/assets
COPY doc /home/developer/project/doc
COPY docker /home/developer/project/docker
COPY ios /home/developer/project/ios
COPY lib /home/developer/project/lib
COPY macos /home/developer/project/macos
COPY scripts /home/developer/project/scripts
COPY test /home/developer/project/test
COPY test_environment /home/developer/project/test_environment
COPY tool /home/developer/project/tool
COPY web /home/developer/project/web
# Run basic check to download Dark SDK
RUN flutter doctor
I would like to know the possibility of remote debugging rather than trying to solve the issue for this particular test.
Thanks in advance 🙏 !!!
Related
Below issue facing while creating docker file in flutter web
enter image description here
anyone have idea about how to create docker file in flutter web.....
I tried many resources but still stuck in issue...
resource or link or solution about same
It is hard to help you without seeing your Dockerfile.
This is the multistaged one I use with nginx:
#Stage 1 - Install dependencies and build the app
FROM debian:latest AS build-env
# Install flutter dependencies
RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3
RUN apt-get clean
# Clone the flutter repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
# Set flutter path
# RUN /usr/local/flutter/bin/flutter doctor -v
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# Run flutter doctor
RUN flutter doctor -v
# Enable flutter web
RUN flutter channel master
RUN flutter upgrade
RUN flutter config --enable-web
# Copy files to container and build
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
RUN flutter create .
RUN flutter build web
# Stage 2 - Create the run-time image
FROM nginx:1.21.1-alpine
COPY --from=build-env /app/build/web /usr/share/nginx/html
If you need a highly optimized image I would not use this one. How ever it does the trick for me.
So recently (5th September) the Alpine Linux package repo was updated to postgresql-client 12.4
I'm referencing version 12.3 in my Dockerfile (apk add postgresql-client=~12.3). Is it not possible to install that version now?
I'd like to update on my time and terms, why should I be forced to update now? Is there another repository I can add to use the older version?
Thanks
Unfortunately, Alpine packages are always updated in place to the latest version, and older versions are discarded. This could be painful, indeed...
Usually, when a package is updated, it's updated with all Alpine distro versions that it's compatible to. For example, postgresql-client was bumped to 12.4-r0 on edge, v3.12 and v3.11, but on Alpine v3.10 repos you'll still find 11.9-r0. In case this was enough, the old version could be installed from the desired repository, as long as it lasts, using:
apk add postgresql-client=11.9-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main
However, since 12.3 doesn't live in the official Alpine repositories anymore, you could rely on an external Docker image, instead.
Luckily, the postgres official images has version tags, and you can find the desired Alpine image for 12.3:
$ wget -q https://registry.hub.docker.com/v1/repositories/postgres/tags -O - | jq -r '.[].name' | grep 12.3
12.3
12.3-alpine
Therefore, you can use FROM:postgres:12.3-alpine to get the desired version from.
In tougher cases, where the Alpine package version is updated, and couldn't be found in other images, the only resort may be building from source.
for example; the latest dnsmasq version ins 2.84-r0 at now, if you install 2.83-r0, will:
$ docker run --rm -ti alpine:3.13
$ apk add 'dnsmasq-dnssec==2.83-r0'
fetch https://mirrors.aliyun.com/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://mirrors.aliyun.com/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
dnsmasq-dnssec-2.84-r0:
breaks: world[dnsmasq-dnssec=2.83-r0]
The best thing you can achieve is using repositories of the earlier releases, at the websiete https://pkgs.alpinelinux.org/packages to search the old version, will find 2.83-r0 in https://pkgs.alpinelinux.org/packages?name=dnsmasq&branch=v3.12.
so add the old repo
$ echo 'http://dl-cdn.alpinelinux.org/alpine/v3.12/main' >> /etc/apk/repositories
$ apk add 'dnsmasq-dnssec==2.83-r0'
fetch http://mirrors.aliyun.com/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://mirrors.aliyun.com/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/3) Installing gmp (6.2.0-r0)
(2/3) Installing nettle (3.5.1-r1)
(3/3) Installing dnsmasq-dnssec (2.83-r0)
Executing dnsmasq-dnssec-2.83-r0.pre-install
Executing busybox-1.31.1-r16.trigger
OK: 7 MiB in 17 packages
Another solution based on the answer of #valiano.
For upgrading postgresql to a newer version, it is recommended to use the higher version pg_dump binaries. But how to get these into your image?
This works for me:
Dockerfile:
ARG VERSION=10
ARG UPGRADE_VERSION=11
ARG TYPE
###############################################################
# Normal server
###############################################################
FROM postgres:${VERSION}-alpine AS server
RUN apk update \
&& apk add --upgrade apk-tools \
&& apk upgrade --available
COPY /rootfs/ /
###############################################################
# Upgrade version with upgrade executables
###############################################################
FROM postgres:${UPGRADE_VERSION}-alpine AS upgrade_version
RUN apk update \
&& apk add --upgrade apk-tools \
&& apk upgrade --available
###############################################################
# Add postgresql upgrade client executables to upgrade_server_layer
###############################################################
FROM server AS upgrade_server
RUN mkdir -p /usr/local/postgresql/upgrade
COPY --from=upgrade_version /usr/local/bin/pg* /usr/local/postgresql/upgrade/
###############################################################
# Final version
###############################################################
FROM ${TYPE}server AS final
Then build your normal server as:
docker build --build-arg TYPE= --build-arg VERSION=11 --build-arg UPGRADE_VERSION=12 -t my_normal_server:11 .
And a server with upgrade binaries, to make the dumpfile:
docker build --build-arg TYPE=upgrade_ --build-arg VERSION=10 --build-arg UPGRADE_VERSION=11 -t my_upgrade_server:10 .
Upgrade scenario if current version is postgresql 10 and you want to upgrade to 11:
Build an upgrade version and a normal version.
Stop the postgresql 10 container and replace it with the my_upgrade_version:10
Create a dumpfile with the /usr/local/postgresql/upgrade/pg_dump.
Create a new postgresql 11 container with my_normal_version:11 with access to the dumpfile and use pg_restore to restore the created dumpfile.
About making a dry single-point-of-entry for fixed package versions:
I use the following method, where I have an .env file where I store the PG major and minor version. I only need to update the .env-file entry with preferred version numbers and rebuild my images to upgrade the Postgres.
As long as the package is present with the corresponding version in the dockerhub and the PG version itself isn't deprecated by the alpine repositories or sth:
Step 1: Specify the PG version in .env file as single point of entry:
PG_MAJOR_VERSION=14
PG_MINOR_VERSION=5
Step 2: Reference the db-package inside the docker-compose:
services:
db:
image: postgres:${PG_MAJOR_VERSION}.${PG_MINOR_VERSION}-alpine
Step 3: Use the variables inside the Dockerfile itself if needed:
ARG RUBY_VERSION
ARG DISTRO_NAME
FROM ruby:${RUBY_VERSION}-${DISTRO_NAME}
# Need to define the args again:
ARG DISTRO_NAME
ARG PG_MAJOR_VERSION
RUN apk add --update build-base bash bash-completion libffi-dev tzdata postgresql$PG_MAJOR_VERSION-client postgresql$PG_MAJOR_VERSION-dev nodejs npm yarn
NB! The FROM clause loses the ARG-variables defined before it. Therefore if you need them later then you need to define them again after the FROM-clause. This issue is described in more detail in this Github issue
Depending on the packages you wish to install you can specify the minor version or other suffixes as needed (for ex for postgresql15-client-15.1-r0 and postgresql15-dev-15.1-r0: package etc)
I am trying to install php7-mongodb with my dockerfile. The same worked until yesterday but today dockerbuild is throwing the following error
Step 4/12 : RUN apk add php7-mongodb
---> Running in b6713ea15c9d
php7-mongodb (missing):
ERROR: unsatisfiable constraints:
required by: world[php7-mongodb]
The command '/bin/sh -c apk add php7-mongodb' returned a non-zero code: 1
I tried with apk update and apk upgrade in the dockerfile but still not working. any idea what the issue is?
I am using alpine edge as base version.
We can recreate the issue by using the following dockerfile
FROM alpine:edge
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk update && apk upgrade
RUN apk add php7-mongodb
tldr: The package renamed to php7-pecl-mongodb in 3.9 and no longer exists in later releases
The package was renamed to php7-pecl-mongodb with this commit: https://git.alpinelinux.org/aports/commit/?id=b3d534d73c690baf458d9cda5dca5ee52ca9cafc
But the package was removed shortly after that due to a nonfree licence change by the package: https://git.alpinelinux.org/aports/commit/community/php7-pecl-mongodb/APKBUILD?id=8a901de31fa055ed591d487e12f8bb9ffcc0df21
According to https://pkgs.alpinelinux.org/packages?name=php7-mongodb&branch=edge there is no such package in alpine edge version.
The latest alpine version that has the php7-mongodb package in its repos seems to be 3.8: https://pkgs.alpinelinux.org/packages?name=php7-mongodb&branch=v3.8
I can't tell you what's the reason that this package is not contained in 3.9 and edge. But if this is an option for you use alpine:3.8 as the base image instead of alpine:edge
Using Alpine 3.8 will fix the issue for you. Change
FROM alpine:edge
To
FROM alpine:3.8
You will also need to change the repository URL so it's point at v3.8. I've been using main so the second line would look like below for me.
RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories
I don't think /testing exists for older releases so you'll need to experiment to find out what works for you. Or perhaps someone else can clarify this for us.
It means you're not using the latest Alpine but you will be able to build the container.
I have an operating environment that is Alpine linux only and I need to install VS Code. How can VS Code be run on Alpine Linux?
Dockerfile:
FROM node:14.19.0-alpine
RUN set -x \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk upgrade \
&& apk --no-cache add alpine-sdk bash libstdc++ libc6-compat \
&& npm config set python python3
RUN git clone --recursive https://github.com/cdr/code-server.git
RUN cd code-server
RUN yarn global add code-server
ENV PASSWORD=changeme
ENTRYPOINT code-server --bind-addr 0:8443
Commands:
docker build . -t vscode
docker run -d -e PASSWORD=111111 -p8443:8443 vscode:latest
http://hostname:8443
Download it in Flatpak repos, it will run natively in a Gnome SDK environment.
Use a self-hosted environment such as Theia (https://www.theia-ide.org/index.html) or coder-editor (https://coder.com/). I've never tried them, I use the Flatpak one, but they seem interesting (you can "build" your osn editor in a Node environment).
Apologies for necrobump, but as what Marco suggested, coder.com has moved to github
the software, code-server is quite litterally VSCode, as a web application, I have been using this for about half a year and it is quite well developed, Alpine support is still spotty but i recall getting a few releases to function well a while back when i ran Alpine as my main.
Can anyone suggest me a better documentation about spark-jobserver. I have gone through the url spark-jobserver but unable to follow the same. It will be great if some one explain step by step instruction on how to use spark-jobserver.
Tools used in building the project.
sbt launcher version 0.13.5
Scala code runner version 2.11.6
With the above mentioned tools I am getting errors while building the spark-jobserver.
The documentation provided in the jobserver repo is indeed confusing.
Here's the steps I followed to manually build and run Spark Job Server on a local machine.
1. git clone https://github.com/spark-jobserver/spark-jobserver
2. sudo mkdir -p /var/log/job-server
3. sudo chown user1:user1 /var/log/job-server
4. cd spark-jobserver
5. sbt job-server/assembly
6. cd config
7. cp local.sh.template abc.sh # Note that the same name 'abc' is used in steps 8 and 10 as well
8. cp ec2.conf.template abc.conf
9. cd .. # The jobserver root dir
10. ./bin/server_package.sh abc # This script copies the files and packages necessary to run job server into a single dir [ default - /tmp/job-server]
11. cd /tmp/job-server [This is where the files and packages necessary to run job server are published by default]
12. ./server_start.sh
13. Run ./server_stop.sh to stop the server
Hope this helps
Here are the steps that I used to install:
Clone the jobserver repo.
Get sbt using wget https://dl.bintray.com/sbt/native-packages/sbt/0.13.8/sbt-0.13.8.tgz
Move "sbt-launch.jar" in sbt/bin to /bin
Create a script /bin/sbt, contents found here, making sure to change the pointer to java if necessary
Make the above script executable
Now cd into the spark jobserver directory, and run sbt publish-local
Assuming the above was successful, run sbt in the same directory
Finally, use the command re-start, and if it succeeds the server is now running!