Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
devksingh4 committed Jan 23, 2023
2 parents 0051745 + 2b2afdf commit 00ba7d0
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 12 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'AMD64/ARM64 image builder'

on:
push:
tags:
- '*'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/acm-uiuc/linkry:latest,ghcr.io/acm-uiuc/linkry:${{github.ref_name}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @devksingh4
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021-2022 EpochML and ACM @ UIUC
Copyright 2021-2023 EpochML and ACM @ UIUC

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Expand All @@ -8,4 +8,4 @@ Redistribution and use in source and binary forms, with or without modification,

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 changes: 34 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,40 @@ Linkry is an internal tool for shortening links and reducing link rot by redirec

## Installation

Ensure that you have [Node](https://nodejs.org/en/) and [Yarn](https://yarnpkg.com/) installed on your machine. For non-ACM users, configure config.js to use your AAD tenant's client ID.
Then, run the following commands:
Pull the published Docker container using the appropriate version: `docker pull ghcr.io/acm-uiuc/linkry:latest`.

Create a `.env` file that contains the following keys:
```bash
yarn
export proto=http
export baseURL=localhost:9215
export SESSION_DB_FILE_LOC=$PWD
export SESSION_DB_FILE_NAME=db.sqlite3
export DB_FILE=db.sqlite3
export CLIENT_SECRET=<your azure AD secret here>
yarn dev
NODE_ENV=production # or development if in development mode
BASE_URL=go.acm.illinois.edu # production URL
BASE_PROTO=https # http vs. https
AAD_CLIENT_ID=0 # Client ID in Azure Active Directory (ensure idtoken flow is enabled).
AAD_TENANT_ID=0 # Azure AD Tenant ID
AAD_CLIENT_SECRET= # Azure AD client secret for respective client ID.
brandTitle=ACM Link Shortener # HTML title
brandLoginProvider=ACM # Custom name for AAD Auth Provider
brandLogoPath=https://go.acm.illinois.edu/static/img/white-banner.svg # path to banner logo
brandOrgHome=https://acm.illinois.edu # main home page
brandStatusURL=https://status.acm.illinois.edu # Status page
brandCopyrightOwner=ACM @ UIUC # Corporation Name
brandDomainHint=devksingh.com # Azure AD Domain Hint
DB_FILE=/usr/src/app/db.sqlite3 # where the DB of links is.
GROUPS_PERMITTED=ACM Link Shortener Admins, ACM Exec # Groups that can access the link shortener
```
Then, use the following docker-compose.yml in the same directory and run `docker-compose up` to start the application (it will be exposed on port 9215):
```yml
version: '3'
services:
linkry:
image: ghcr.io/acm-uiuc/linkry:latest
restart: on-failure
environment:
- DB_FILE=/usr/src/app/db.sqlite3
ports:
- "9215:9215"
volumes:
- ./.env:/usr/src/app/.env
- ./db.sqlite3:/usr/src/app/db.sqlite3
```

## Usage
Expand All @@ -29,3 +52,4 @@ Maintainer: Dev Singh (<[email protected]>)

## License
[BSD 3-Clause](https://raw.githubusercontent.com/acm-uiuc/linkry/master/LICENSE)

0 comments on commit 00ba7d0

Please sign in to comment.