Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7e747e4
added basic api call functionality
qvalentin Feb 20, 2021
45c79ec
dont throw execptions, get reponse values
qvalentin Feb 21, 2021
6307305
handle status codes
qvalentin Feb 28, 2021
9d11602
upload of one file works
qvalentin Mar 6, 2021
6e20ff7
basic download functionality
qvalentin Mar 6, 2021
aa69ada
use a stack project instead of a single file, this enables typechecking
qvalentin Mar 6, 2021
79ca996
use a stack project instead of a single file, this enables typechecking
qvalentin Mar 7, 2021
4df783b
remove old main file
qvalentin Mar 7, 2021
4308dc2
cleanup arg handlign
qvalentin Mar 13, 2021
22bdfe3
added build pipeline and docker image
qvalentin Mar 13, 2021
48f0a7b
change readme
qvalentin Mar 13, 2021
e01dc1d
minor chnges on profile and headers
qvalentin Mar 23, 2021
74e7af4
only use json, add header for filesize
qvalentin Mar 24, 2021
ec5566a
add mimetype
qvalentin Mar 24, 2021
bde238f
add mimetype
qvalentin Mar 24, 2021
524fd87
refactor rest response type
qvalentin Mar 24, 2021
ce24243
add feature release workflow
qvalentin Mar 24, 2021
06c18a0
upload file to /tmp an not to memory
qvalentin Mar 26, 2021
de76b01
tweak dockerfile for security and logging
qvalentin Mar 26, 2021
af43665
prepare deployemnt
qvalentin Mar 27, 2021
4cb6db1
change rest port
qvalentin Mar 27, 2021
d541b38
needs more cow bell
qvalentin Mar 29, 2021
7eea01a
fix url handling
qvalentin Mar 29, 2021
0d6b71f
added deleteEndpoint (wip)
qvalentin Apr 10, 2021
5c7c85f
setup for tests
qvalentin Apr 10, 2021
43b6ef9
delete endpoint working
qvalentin Apr 11, 2021
7970fd7
added more headers and health endpoint
qvalentin Apr 17, 2021
dce7c72
prepare downlaod endpoint
qvalentin Apr 19, 2021
abd4638
added zipping of files for downloading
qvalentin Apr 25, 2021
15a4c6e
use temporary file also for deleting
qvalentin Apr 26, 2021
923aa60
change return type of upload endpoint, extend health
qvalentin May 8, 2021
d58edf5
add more error handling
qvalentin May 8, 2021
e919238
Format the code
qvalentin May 10, 2021
8343c72
add stage profile
qvalentin May 11, 2021
0fe20e6
make mimetype as possible null value, (clean this up later)
qvalentin May 12, 2021
538a2c2
cleanup, add stable pipeline
qvalentin May 13, 2021
31b1444
add possible null values
qvalentin May 13, 2021
c219a25
fix pipeline name, dont run feature pipeline all the time
qvalentin May 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/featureRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Feature Release

on:
workflow_dispatch:
push:
branches:
- 'featureWithPipeline/**'
paths:
- 'app/**'
- 'src/**'
- 'test/**'

jobs:
Build_Docker_Image_on_Push:
runs-on: ubuntu-latest
steps:
-
name: Set up Project
uses: actions/checkout@v2
-
name: Build Filehandler
run: |
stack build

-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PW }}
-
name: Build and push
run: |
BINLOCATION=$(stack path --local-install-root)
BINLOCATION=$(realpath --relative-to=. $BINLOCATION)
docker build -t filefighter/filehandler:feature . --build-arg BINLOCATION=$BINLOCATION
docker push filefighter/filehandler:feature
40 changes: 40 additions & 0 deletions .github/workflows/latestRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Latest Release

on:
workflow_dispatch:
push:
branches: "master"
paths:
- 'app/**'
- 'src/**'
- 'test/**'

jobs:
Build_Docker_Image_on_Push:
runs-on: ubuntu-latest
steps:
-
name: Set up Project
uses: actions/checkout@v2
-
name: Build Filehandler
run: |
stack build

-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PW }}
-
name: Build and push
run: |
BINLOCATION=$(stack path --local-install-root)
BINLOCATION=$(realpath --relative-to=. $BINLOCATION)
docker build -t filefighter/filehandler:latest . --build-arg BINLOCATION=$BINLOCATION
docker push filefighter/filehandler:latest
-
name: Trigger update on server
run:
- curl -u ${{ secrets.LOG_CREDS }} https://logs.filefighter.de/filefighter-update.log
34 changes: 34 additions & 0 deletions .github/workflows/stableRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Stable Release

on:
push:
tags:
- 'v*.*.*'

jobs:
Build_Docker_Image_on_Push:
runs-on: ubuntu-latest
steps:
-
name: Set up Project
uses: actions/checkout@v2
-
name: Build Filehandler
run: |
stack build

-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PW }}
-
name: Build and push
run: |
VERSION=${{ steps.vars.outputs.tag }}
BINLOCATION=$(stack path --local-install-root)
BINLOCATION=$(realpath --relative-to=. $BINLOCATION)
docker build -t filefighter/filehandler:$VERSION -t filefighter/filehandler:stable . --build-arg BINLOCATION=$BINLOCATION
docker push filefighter/filehandler:$VERSION
docker push filefighter/filehandler:stable
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog for Filehandler

## Unreleased changes
36 changes: 13 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
FROM ubuntu:16.04
FROM ubuntu:latest

# Get dumb-init to avoid Ctrl-C issues. See:
# http://engineeringblog.yelp.com/2016/01/dumb-init-an-init-for-docker.html
ADD https://github.com/Yelp/dumb-init/releases/download/v1.1.3/dumb-init_1.1.3_amd64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init
ARG BINLOCATION
ENV RESTURL=FileFighterREST
ENV PROFILE=prod

# Set up Haskell Stack, the Haskell build tool.
# Stack is the only dependency we have to run our application.
# Once available, it will grab everything else we need
# (compiler, libraries, etc).
ADD https://get.haskellstack.org/get-stack.sh /usr/local/bin/
RUN sh /usr/local/bin/get-stack.sh
RUN apt-get update && apt-get upgrade -y

# Copy over the source code and make it executable.
COPY FileHandler.hs /usr/local/bin/file-handler
RUN chmod +x /usr/local/bin/file-handler
ADD $BINLOCATION/bin/Filehandler-exe /usr/local/bin/filehandler-exe
RUN chmod +x /usr/local/bin/filehandler-exe

# Create a new user account and directory to run from, and then
# run everything else as that user.
RUN useradd -m www && mkdir -p /workdir && chown www /workdir
USER www

# We run our application with "sanity" to force it to install all of
# its dependencies during Docker image build time, making the Docker
# image launch much faster.
RUN /usr/local/bin/file-handler sanity
# TODO: because we want to write to a host directory we must run as root, or change the permissions of the directory
# create group and user, then the working dir and add permissions to it
#RUN groupadd -g 999 appuser && useradd -r -u 999 -g appuser appuser && mkdir -p /workdir && chown appuser /workdir
#USER appuser

# We're all ready, now just configure our image to run the server on
# launch from the correct working directory.
CMD ["/usr/local/bin/dumb-init", "/usr/local/bin/file-handler"]
# using exec solves ctl + c issues
CMD exec /usr/local/bin/filehandler-exe ${RESTURL} $PROFILE
WORKDIR /workdir
EXPOSE 5000
143 changes: 0 additions & 143 deletions FileHandler.hs

This file was deleted.

82 changes: 82 additions & 0 deletions Filehandler.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.33.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: 810c23ddfee0d410c3632560ab726ca5db1e957ed8095989f8e2e7e554eb65f4

name: Filehandler
version: 0.1.0.0
description: Please see the README on GitHub at <https://github.com/githubuser/Filehandler#readme>
homepage: https://github.com/githubuser/Filehandler#readme
bug-reports: https://github.com/githubuser/Filehandler/issues
author: Author name here
maintainer: example@example.com
copyright: 2021 Author name here
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
ChangeLog.md

source-repository head
type: git
location: https://github.com/FileFighter/Filehandler

library
exposed-modules:
Lib
other-modules:
Paths_Filehandler
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
default-language: Haskell2010

executable Filehandler-exe
main-is: Main.hs
other-modules:
Paths_Filehandler
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
Filehandler
, base >=4.7 && <5
, req
, wai
, wai-app-static
, wai-extra
, wai-cors
, warp
, network
, text
, aeson
, filepath
, http-types
, bytestring
, directory
, case-insensitive
, mtl
, resourcet
, zip
, temporary
default-language: Haskell2010

test-suite Filehandler-test
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
Paths_Filehandler
hs-source-dirs:
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
Filehandler
, base >=4.7 && <5
, hspec
, QuickCheck
default-language: Haskell2010
Loading