Skip to content

Commit

Permalink
Boot up staging env (#21)
Browse files Browse the repository at this point in the history
* Add staging files
* Enable s3filestore and disable init cont.
* Initial frontend (#23)

---------

Co-authored-by: Luccas Mateus <luccasmmg@gmail.com>
  • Loading branch information
MuhammadIsmailShahzad and luccasmmg authored Oct 12, 2023
1 parent 6ff9bd3 commit 073ea4b
Show file tree
Hide file tree
Showing 32 changed files with 5,998 additions and 31 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Build and Deploy to AWS
on:
push:
branches:
- dev
- staging
env:
PROJECT_NAME: wri-odp
BRANCH_NAME: dev
BRANCH_NAME: staging
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -85,7 +85,6 @@ jobs:
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'

- name: Tear down containers
if: failure() || success()
run: docker-compose -f docker-compose.test.yml --env-file .env.example down -v --remove-orphans
Expand Down
9 changes: 5 additions & 4 deletions ckan-deployment/ckan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ ENV CKAN_INI /srv/app/production.ini
# Install any extensions needed by your CKAN instance
RUN pip3 install -e 'git+https://github.com/datopian/ckanext-scheming.git@ckan-2.10#egg=ckanext-scheming' && \
pip3 install -r 'https://raw.githubusercontent.com/datopian/ckanext-scheming/ckan-2.10/test-requirements.txt' && \
pip3 install -e 'git+https://github.com/datopian/ckanext-s3filestore.git@ckan-2.10#egg=ckanext-s3filestore' && \
pip3 install -r 'https://raw.githubusercontent.com/datopian/ckanext-s3filestore/ckan-2.10/requirements.txt' && \
pip3 install -r 'https://raw.githubusercontent.com/datopian/ckanext-s3filestore/ckan-2.10/dev-requirements.txt'
pip3 install -e 'git+https://github.com/datopian/ckanext-s3filestore.git@wri/cost-splitting-orgs#egg=ckanext-s3filestore' && \
pip3 install -r 'https://raw.githubusercontent.com/datopian/ckanext-s3filestore/wri/cost-splitting-orgs/requirements.txt' && \
pip3 install -r 'https://raw.githubusercontent.com/datopian/ckanext-s3filestore/wri/cost-splitting-orgs/dev-requirements.txt'


#COPY patches ${APP_DIR}/patches
#RUN for d in $APP_DIR/patches/*; do \
Expand All @@ -18,7 +19,7 @@ RUN pip3 install -e 'git+https://github.com/datopian/ckanext-scheming.git@ckan-2
# fi ; \
# done

ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars
ENV CKAN__PLUGINS image_view text_view webpage_view resource_proxy datatables_view datastore datapusher activity s3filestore envvars

RUN ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}"

Expand Down
20 changes: 20 additions & 0 deletions ckan-deployment/frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Since the ".env" file is gitignored, you can use the ".env.example" file to
# build a new ".env" file when you clone the repo. Keep this file up-to-date
# when you add new variables to `.env`.

# This file will be committed to version control, so make sure not to have any
# secrets in it. If you are cloning this repo, create a copy of this file named
# ".env" and populate it with your secrets.

# When adding additional environment variables, the schema in "/src/env.mjs"
# should be updated accordingly.

# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
# https://next-auth.js.org/configuration/options#secret
NEXTAUTH_SECRET="secret"
NEXTAUTH_URL="http://localhost:3000"

# Next Auth CKAN Login Provider
CKAN_URL="https://demo.dev.datopian.com"
30 changes: 30 additions & 0 deletions ckan-deployment/frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/** @type {import("eslint").Linter.Config} */
const config = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint"],
extends: [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
rules: {
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",

"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
},
};

module.exports = config;
45 changes: 45 additions & 0 deletions ckan-deployment/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
**/*/node_modules
/.pnp
.pnp.js

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal

# next.js
/.next/
/out/
next-env.d.ts

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env
.env*.local
**/*/.env
**/*/.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
19 changes: 19 additions & 0 deletions ckan-deployment/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:18

# Create app directory
WORKDIR /usr/src/app

ENV NEXTAUTH_SECRET "secret"
ENV NEXTAUTH_URL "http://localhost:3000"
ENV CKAN_URL "https://demo.dev.datopian.com"

COPY . .

# You can setup env vars here or via `.env` file

RUN npm ci
RUN npm run build
EXPOSE 3000

# For staging/production please use `yarn start` command.
CMD [ "npm", "run", "start"]
28 changes: 28 additions & 0 deletions ckan-deployment/frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Create T3 App

This is a [T3 Stack](https://create.t3.gg/) project bootstrapped with `create-t3-app`.

## What's next? How do I make an app with this?

We try to keep this project as simple as possible, so you can start with just the scaffolding we set up for you, and add additional things later when they become necessary.

If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help.

- [Next.js](https://nextjs.org)
- [NextAuth.js](https://next-auth.js.org)
- [Prisma](https://prisma.io)
- [Tailwind CSS](https://tailwindcss.com)
- [tRPC](https://trpc.io)

## Learn More

To learn more about the [T3 Stack](https://create.t3.gg/), take a look at the following resources:

- [Documentation](https://create.t3.gg/)
- [Learn the T3 Stack](https://create.t3.gg/en/faq#what-learning-resources-are-currently-available) — Check out these awesome tutorials

You can check out the [create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) — your feedback and contributions are welcome!

## How do I deploy this?

Follow our deployment guides for [Vercel](https://create.t3.gg/en/deployment/vercel), [Netlify](https://create.t3.gg/en/deployment/netlify) and [Docker](https://create.t3.gg/en/deployment/docker) for more information.
22 changes: 22 additions & 0 deletions ckan-deployment/frontend/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
await import("./src/env.mjs");

/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,

/**
* If you are using `appDir` then you must comment the below `i18n` config out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
i18n: {
locales: ["en"],
defaultLocale: "en",
},
};

export default config;
Loading

0 comments on commit 073ea4b

Please sign in to comment.