howto prebuild on gitpod with haskell and stack - haskell

I have checked out https://github.com/gitpod-io/template-haskell
and merged samples for a book (haskell in depth) into my branch.
Prebuilding has no effect, every opening of a workspace begins the entire build process from the beginning. So gitpod is effectively unusable for this project, as Zou have to wait for the entire build to complete, before ou can start using the workspace.
I presume the reason might be, that stack build stores the build artefacts in ~/.stack and that location is not part of the workspace, so it's lost when the workspace is closed.
Is that right? And then, how to keep the build result alive?

I just started using Gitpod so I'm not sure if there's a better way to do this, but I was able to get pretty close to what I wanted out of a prebuild by specifying a base dockerfile by putting this in my gitpod.yml:
image:
file: .gitpod.Dockerfile
and then creating a .gitpod.Dockerfile that starts with
FROM gitpod/workspace-full
and then install ghcup and use it to install my other dependencies:
RUN curl --proto 'https' -tlsv1.2 -sSf https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ./ghcup
RUN chmod 755 ./ghcup
RUN sudo mv ./ghcup /usr/local/bin
RUN ghcup install ghc
RUN ghcup install cabal
RUN ghcup install hls
RUN ghcup install stack
RUN sudo ln -s /home/gitpod/.ghcup/bin/stack /usr/local/bin/stack
RUN stack install ghcid

Related

Plain installation of current version of Wekan on Ubuntu?

Wekan is an open-source Kanban Board which used to be easy to install using nodejs (given that you already set up your MongoDB). I am stumbling upon the actual installation steps of the guide to install Wekan on Ubuntu 16.04:
Download the latest version wekan source code using the wget command and extract it.
wget https://github.com/wekan/wekan/releases/download/v0.63/wekan-0.63.tar.gz
tar xf wekan-0.63.tar.gz
And you will get a new directory named bundle. Go to that directory and install the Wekan dependencies using the npm command as shown below.
cd bundle/programs/server
npm install
Figuring out the last stable version is easy, there are new stable versions nearly every day (as of March 2019), which somehow seem to contradict the common definition.
More importantly, the directory bundle/programs/server does not exist, only server, but it does not contain a main.js which would be necessary to run
node main.js
Other resources considered:
I did of course check the official documentation, but it looks not up-to-date. The page https://github.com/wekan/wekan/wiki/Install-and-Update is redirecting to a rather untidy page which does no longer talk about a standalone installation.
I prefer a minimal installation and not a solution using snap like described at computingforgeeks
There is also an unanswered question about a more specific installation around: Installing Wekan via Sandstorm on cPanel which follows a similar approach.
The latest releases on the Wekan page are actually no ready-to-use node builds.
Wekan is built using Meteor and you will need Meteor to create the build. This is because you could also build it using Meteor against other architectures than os.linux.x86_64.
So here is how to build the latest release as of today on your dev-machine to then deploy it:
Build it yourself
[1.] Install Meteor
curl https://install.meteor.com/ | sh
[2.] Download and extract the latest Wekan
wget https://github.com/wekan/wekan/archive/v2.48.tar.gz
tar xf wekan-2.48.tar.gz
cd wekan-2.48
[3.] Install Wekan Dependencies
./rebuild-wekan.sh
# use option 1
[4.] Install dependency Meteor packages
Now it gets dirty. Somehow the required packages are not included in the release (an issue should be opened at GH). You need to install them yourself:
# create packages dir
mkdir -p packages
cd packages
# clone packages
git clone git#github.com:wekan/wekan-ldap.git
git clone git#github.com:wekan/meteor-accounts-cas.git
git clone git#github.com:wekan/wekan-scrollbar.git
# install repo and extract packages
git clone git#github.com:wekan/meteor-accounts-oidc.git
mv meteor-accounts-oidc/packages/switch_accounts-oidc ./
mv meteor-accounts-oidc/packages/switch_oidc ./
rm -rf meteor-accounts-oidc/
cd ../
[5.] Build against your architecure
meteor build ../build --architecute os.linux.x86_64
# go grab a coffee... yes even with nvme SSD...
Once the build is ready you can go ../build and check out the wekan-2.48.tar.gz which now contains your built bundle including the described folders and files.
Use this bundle to deploy as described in the documentation.
Summary
This describes only how to create the build yourself and I am not giving any guarantee that the build package will run when deployed to your target environment.
I think there is either some issue with the way the releases are attached on GH or they explicitly want to keep it open against which arch you want to build.
In any case I would open an issue with demand for a more clear documentation and a description for reproduction of the errors your mentioned.
Further readings
https://guide.meteor.com/deployment.html#custom-deployment

Installing a software and setting up environment variable in Dockerfile

I have a jar file, which I need to create a docker image. My jar file is dependent on an application called ImageMagick. Basically, ImageMagick will be installed and the path to image magick will be added as an environmental variable. I am new to Docker, and based on my understanding, I believe, a container can access only resource within the container.
So I created a docker file, as such
FROM openjdk:8
ADD target/eureka-server-1.0.0-RELEASE.jar eureka-server-
1.0.0-RELEASE.jar
EXPOSE 9991
RUN ["yum","install","ImageMagick"]
RUN ["export","imagemagix_home", "whereis ImageMagick"](Here is what am
struggling that, i need to set env variable by taking the installation
directory of imagemagick. Currently iam getting null)
ENTRYPOINT ["java","-jar","eureka-server-1.0.0-RELEASE.jar"]
Please let me know, whether the solution am trying is proper, or is there any better solution for my problem.
Update,
As am installing an application and setting env variable at the build time, passing an argument in -e runtime is no use.I have updated my docker file as below,
FROM openjdk:8
ADD target/eureka-server-1.0.0-RELEASE.jar eureka-server-
1.0.0-RELEASE.jar
EXPOSE 9991
RUN ["yum","install","ImageMagick"]
ENV imagemagix_home = $(whereis ImageMagick)
RUN ["wget","https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-
static.tar.xz"]
RUN ["tar","xvf","ffmpeg-git-*.tar.xz"]
RUN ["cd","./ffmpeg-git-*"]
RUN ["cp","ff*","qt-faststart","/usr/local/bin/"]
ENV ffmpeg_home = $(whereis ffmpeg)
ENTRYPOINT ["java","-jar","eureka-server-1.0.0-RELEASE.jar"]
And while am building, iam getting an error that,
OCI runtime create failed: conatiner_linux.go: starting container process caused "exec": "\yum": executable file not found in $PATH: unknow.
Update
yum is not available in my base image package, so I changed yum as apt-get as below,
RUN apt-get install build-essential checkinstall && apt-get build-dep
imagemagick -y
Now am getting package not found build-essential, check install. returned
a non-zero code 100
Kindly let me know whats going wrong
It seems build-essential or checkinstall is not available. Try installing them in separate commands. Or searching for them.
Maybe you need to do apt-et update to refresh the repository cache before installing them.

Where does 'stack build PKG' install 'PKG'; how do I isolate the install of 'PKG'?

I'm confused about where stack build PKG places the packages it installs. I had thought that, for example
mkdir foo
cd foo
stack build PKG_IN_HACKAGE_NOT_IN_RESOLVER
would create foo/.stack-work and put the specified package there (as if to had been specified as an "extra dependency"); but I seen on .stack-work and the package is available globally on my system.
If what I want is an entirely isolated (temporary) Haskell configuration in which to install and use PKG, how do I do that?

Installing nodejs: I need GNU make. Please run 'gmake' instead

I want to install nodejs on my PCBSD 10 system. I have downloaded the src file of latest nodejs. On terminal I ran the command ./configure It runs fine. After that I tried make but its asking on console
I need GNU make. Please run 'gmake' instead.
Then I tried gmake the terminal says
CORRECT>gmake (y | n | e | a)?
I pressed y then again it says "I need GNU make. Please run gmake instead"
How to install nodejs???
If you install it using the FreeBSD ports system, that will take care of these details for you.
If you haven't installed the ports tree, run the following command as root;
svnlite checkout https://svn0.us-west.FreeBSD.org/ports/head /usr/ports
Note that there are some subversion mirrors for FreeBSD. Choose the one closest to you. After the initial checkout, you can update the ports tree by running the following command as root;
svnlite update /usr/ports |& less
When the ports tree is installed and up-to-date, you can install node by running the following commands as root:
cd /usr/ports/www/node
make install clean
This will first install the ports that node depends on (gmake and python2) and then node itself.
You might also want to install the node package manager from the www/npm port.

How to create simple coffescript example without rails

I am new to coffeescript. I saw a coffeescript video in Rails casts.com. From that episode I understand how to convert the normal Js and Jquery to coffeescript code and the usage of coffeescript.
I am trying to create a coffeescript example without rails. I wetn through the coffeescript site. They first install Node.js. I tried to install node.js in windows and ubuntu, but I had failures. I followed the instruction as per this site:
http://howtonode.org/how-to-install-nodejs#ubuntu
For ubuntu I got "bash: ./configure?: No such file or directory" error when I execute the following command
./configure
Can anyone help me to create simple coffescript example without rails?
One more thing - In Mac "By the help of homebrew I can see the compiled js of coffescript code through compiled and Display Js window". Are there any options available in windows and ubuntu?
I would bet the easiest way to install Node.js on Ubuntu is through APT:
$ sudo apt-get install nodejs
It probably will get some outdated version but it can be enough for some tests.
If you prefer the latest version (which is a reasonable preference), I bet it would be easier to install Node.js from the dist package. Just copy and paste this on terminal:
wget http://nodejs.org/dist/node-v0.5.0.tar.gz && \
tar zvxf node-v0.5.0.tar.gz && \
cd node-v0.5.0 && \
./configure && \
make && \
sudo make install
This line will:
download the latest Node.js source code with wget http://nodejs.org/dist/node-v0.5.0.tar.gz
uncompress the downloaded source code with tar zvxf node-v0.5.0.tar.gz
enter into the source code with cd node-v0.5.0
set the build parameters with ./configure
effectively build the Node.js executable with make
install the built Node.js in your path with sudo make install
The && means "execute the next command if the previous command succeeds" (for example wget http://nodejs.org/dist/node-v0.5.0.tar.gz && tar zvxf node-v0.5.0.tar.gz means that we will download the package with wget and iff the download succeeds we will unpack the download file with tar. The backslashes (\) are here for allowing us to break all the series of commands in more than one line because, by default, we would have a big line:
wget http://nodejs.org/dist/node-v0.5.0.tar.gz && tar zvxf node-v0.5.0.tar.gz && cd node-v0.5.0 && ./configure && make && sudo make install
Then, you can install npm with this simple command, found in the own npm github page:
$ curl http://npmjs.org/install.sh | sudo sh
With npm, it will be too easy to install coffee, as you can see in the CoffeeScript page:
$ npm install coffee-script
Now, just run your tests:
$ coffee
coffee> a = key: 'value'
{ key: 'value' }
coffee> a.key
'value'
Does it look like to much work? You can try CoffeeScript in the language page. Just click in "Try CoffeeScript" and a console will appear to you.
For testing and demo purposes it may be sufficient to have your CoffeeScript compiled directly in browser. You can include the CoffeeScript compiler and your code in a tag.
This method is not efficient though so please use it for playing around.
Please see this section on how to set things up:
"text/coffeescript" Script Tags
Good luck!
Ubuntu 11.10 has an up-to-date package for CoffeeScript.
sudo apt-get install coffeescript

Resources