Skip to content

Commit

Permalink
Merge pull request #878 from NFDI4Chem/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
NishaSharma14 authored Oct 17, 2023
2 parents 1ba3618 + b126b79 commit 6d1e59c
Show file tree
Hide file tree
Showing 285 changed files with 14,020 additions and 3,499 deletions.
90 changes: 90 additions & 0 deletions .env.ci.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
APP_NAME=Laravel
APP_ENV=development
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:80
APP_DESCRIPTION='nmrXiv is currently developed as the FAIR, consensus-driven NMR data repository and computational platform. The ultimate goal is to accelerate broader coordination and data sharing among natural product (NP) researchers by enabling the storage, management, sharing and analysis of NMR data.'
COOL_OFF_PERIOD=10
SCHEMA_VERSION=beta

SHOW_BANNER=true

GITHUB_LICENSE_URL=https://api.github.com/licenses
EUROPEMC_WS_API=https://www.ebi.ac.uk/europepmc/webservices/rest/search
ORCID_ID_SEARCH_API=https://pub.orcid.org/v2.1/search
ORCID_ID_EMPLOYMENT_API=https://pub.orcid.org/v3.0/{orcid_id}/employments
ORCID_ID_PERSON_API=https://pub.orcid.org/v3.0/{orcid_id}/person

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=postgres
DB_PORT=5432
DB_DATABASE=nmrxiv
DB_USERNAME=postgres
DB_PASSWORD=postgres

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120

MEMCACHED_HOST=memcached

REDIS_CLIENT=predis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=info@nmrxiv.org
MAIL_FROM_NAME="${APP_NAME}"

FILESYSTEM_DRIVER=ceph
FILESYSTEM_DRIVER_PUBLIC=ceph_public

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=nmrxiv
AWS_BUCKET_PUBLIC=nmrxiv-public
AWS_ENDPOINT=https://s3.uni-jena.de
AWS_URL=https://s3.uni-jena.de

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SCOUT_DRIVER=meilisearch
SCOUT_PREFIX=dev_
MEILISEARCH_HOST=https://msdev.nmrxiv.org
MEILISEARCH_KEY=
MEILISEARCH_PUBLICKEY=

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URL=http://localhost:80/auth/login/github/callback

TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TWITTER_REDIRECT_URL=http://localhost:80/auth/login/twitter/callback

TELESCOPE_ENABLED=false

#Bioschema Properties.
NMRXIV_PROVIDER=NFDI4Chem
NMRXIV_PROVIDER_URL=https://www.nfdi4chem.de/
MEASUREMENT_TECHNIQUE=http://purl.obolibrary.org/obo/CHMO_0000613

56 changes: 43 additions & 13 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
APP_NAME=nmrXiv
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=0.0.0.0:80
APP_URL=http://localhost:80
APP_DESCRIPTION='nmrXiv is currently developed as the FAIR, consensus-driven NMR data repository and computational platform. The ultimate goal is to accelerate broader coordination and data sharing among natural product (NP) researchers by enabling the storage, management, sharing and analysis of NMR data.'
COOL_OFF_PERIOD=10
SCHEMA_VERSION=beta

SHOW_BANNER=true

GITHUB_LICENSE_URL=https://api.github.com/licenses
EUROPEMC_WS_API=https://www.ebi.ac.uk/europepmc/webservices/rest/search
ORCID_ID_SEARCH_API=https://pub.orcid.org/v2.1/search
ORCID_ID_EMPLOYMENT_API=https://pub.orcid.org/v3.0/{orcid_id}/employments
ORCID_ID_PERSON_API=https://pub.orcid.org/v3.0/{orcid_id}/person

LOG_CHANNEL=stack
LOG_LEVEL=debug
Expand All @@ -17,12 +28,13 @@ DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120

MEMCACHED_HOST=memcached

REDIS_CLIENT=predis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
Expand All @@ -36,31 +48,49 @@ MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=info@nmrxiv.org
MAIL_FROM_NAME="${APP_NAME}"

FILESYSTEM_DRIVER=minio
FILESYSTEM_DRIVER_PUBLIC=minio_public

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_BUCKET=nmrxiv
AWS_ENDPOINT=http://localhost:9000/
AWS_URL=http://localhost:9000/
AWS_USE_PATH_STYLE_ENDPOINT=false
AWS_BUCKET_PUBLIC=nmrxiv-public

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://meilisearch:7700
SCOUT_PREFIX=dev_
MEILISEARCH_HOST=http://localhost:7700/
MEILISEARCH_KEY=
MEILISEARCH_PUBLICKEY=

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URL=
GITHUB_REDIRECT_URL=http://localhost:80/auth/login/github/callback

TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TWITTER_REDIRECT_URL=http://localhost:80/auth/login/twitter/callback

ORCID_CLIENT_ID=
ORCID_CLIENT_SECRET=
ORCID_REDIRECT_URL=
ORCID_REDIRECT_URL=http://localhost/auth/login/orcid/callback
ORCID_ENVIRONMENT=sandbox

TELESCOPE_ENABLED=false

#Bioschema Properties.
NMRXIV_PROVIDER=NFDI4Chem
NMRXIV_PROVIDER_URL=https://www.nfdi4chem.de/
MEASUREMENT_TECHNIQUE=http://purl.obolibrary.org/obo/CHMO_0000613

TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TWITTER_REDIRECT_URL=
54 changes: 52 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,66 @@ env:
GKE_CLUSTER: nmrxiv-dev
GKE_ZONE: europe-west3-a
DEPLOYMENT_NAME: nmrxiv-nmrxiv-app
SCHEDULER_DEPLOYMENT_NAME: nmrxiv-scheduler
WORKER_DEPLOYMENT_NAME: nmrxiv-worker
REPOSITORY_NAME: nmrxiv-dev
APP_IMAGE: nmrxiv-app
NGINX_IMAGE: nmrxiv-nginx

jobs:
php-unit-test:
name: Run test
runs-on: ubuntu-latest
container:
image: kirschbaumdevelopment/laravel-test-runner:8.2

services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nmrxiv
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Install composer dependencies
run: |
composer install --ignore-platform-reqs
- name: Prepare Laravel Application
run: |
php -r "file_exists('.env') || copy('.env.ci.dev', '.env');"
echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_DEV }} >> .env
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} >> .env
echo MEILISEARCH_KEY=${{ secrets.MEILISEARCH_KEY_DEV }} >> .env
echo MEILISEARCH_PUBLICKEY=${{ secrets.MEILISEARCH_PUBLICKEY_DEV }} >> .env
echo TWITTER_CLIENT_ID=${{ secrets.TWITTER_CLIENT_ID_DEV }} >> .env
echo TWITTER_CLIENT_SECRET=${{ secrets.TWITTER_CLIENT_SECRET_DEV }} >> .env
echo GITHUB_CLIENT_ID=${{ secrets.CLIENT_ID_GITHUB_DEV }} >> .env
echo GITHUB_CLIENT_SECRET=${{ secrets.CLIENT_SECRET_GITHUB_DEV }} >> .env
php artisan key:generate
php artisan migrate --seed
- name: Install front-end dependencies
run: |
npm install
npm run build
- name: Run Test
run: php artisan test --parallel


setup-build-publish-deploy:
name: Deploy to Dev
name: Build & deploy to development
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
#needs: build
needs: php-unit-test
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -68,5 +117,6 @@ jobs:
run: |-
kubectl rollout restart deployment/$DEPLOYMENT_NAME
kubectl rollout restart deployment/$WORKER_DEPLOYMENT_NAME
kubectl rollout restart deployment/$SCHEDULER_DEPLOYMENT_NAME
kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s
kubectl get services -o wide
5 changes: 3 additions & 2 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class CreateNewUser implements CreatesNewUsers
/**
* Create a newly registered user.
*
* @param array $input
* @return \App\Models\User
*/
public function create(array $input)
Expand All @@ -38,7 +37,10 @@ public function create(array $input)
'last_name' => $input['last_name'],
'email' => $input['email'],
'username' => $input['username'],
'orcid_id' => $input['orcid_id'],
'affiliation' => $input['affiliation'],
'password' => Hash::make($input['password']),

]), function (User $user) {
$this->createTeam($user);
});
Expand All @@ -48,7 +50,6 @@ public function create(array $input)
/**
* Create a personal team for the user.
*
* @param \App\Models\User $user
* @return void
*/
protected function createTeam(User $user)
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Fortify/ResetUserPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class ResetUserPassword implements ResetsUserPasswords
* Validate and reset the user's forgotten password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function reset($user, array $input)
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Fortify/UpdateUserPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class UpdateUserPassword implements UpdatesUserPasswords
* Validate and update the user's password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
Expand Down
11 changes: 7 additions & 4 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
* Validate and update the given user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
Expand All @@ -25,6 +24,8 @@ public function update($user, array $input)
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
'username' => ['required', 'string', 'max:255', Rule::unique('users')->ignore($user->id)],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
'orcid_id' => ['nullable', 'string', 'max:255'],
'affiliation' => ['nullable', 'string', 'max:255'],
])->validateWithBag('updateProfileInformation');

if (isset($input['photo'])) {
Expand All @@ -41,6 +42,8 @@ public function update($user, array $input)
'username' => $input['username'],
'name' => $input['username'] ? $input['username'] : $user->name,
'email' => $input['email'],
'orcid_id' => $input['orcid_id'],
'affiliation' => $input['affiliation'],
])->save();
}
}
Expand All @@ -49,18 +52,18 @@ public function update($user, array $input)
* Update the given verified user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
protected function updateVerifiedUser($user, array $input)
{
$user->forceFill([
'first_name' => $input['first_name'],
'last_name' => $input['last_name'],
'name' => $input['name'] ? $input['name'] : $user->name,
'username' => $input['username'],
'name' => $input['username'] ? $input['username'] : $user->name,
'email' => $input['email'],
'email_verified_at' => null,
'orcid_id' => $input['orcid_id'],
'affiliation' => $input['affiliation'],
])->save();

$user->sendEmailVerificationNotification();
Expand Down
5 changes: 0 additions & 5 deletions app/Actions/Jetstream/AddTeamMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class AddTeamMember implements AddsTeamMembers
*
* @param mixed $user
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
public function add($user, $team, string $email, string $role = null)
Expand All @@ -42,8 +40,6 @@ public function add($user, $team, string $email, string $role = null)
* Validate the add member operation.
*
* @param mixed $team
* @param string $email
* @param string|null $role
* @return void
*/
protected function validate($team, string $email, ?string $role)
Expand Down Expand Up @@ -77,7 +73,6 @@ protected function rules()
* Ensure that the user is not already on the team.
*
* @param mixed $team
* @param string $email
* @return \Closure
*/
protected function ensureUserIsNotAlreadyOnTeam($team, string $email)
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Jetstream/CreateTeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class CreateTeam implements CreatesTeams
* Validate and create a new team for the given user.
*
* @param mixed $user
* @param array $input
* @return mixed
*/
public function create($user, array $input)
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Jetstream/DeleteUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class DeleteUser implements DeletesUsers
/**
* Create a new action instance.
*
* @param \Laravel\Jetstream\Contracts\DeletesTeams $deletesTeams
* @return void
*/
public function __construct(DeletesTeams $deletesTeams)
Expand Down
Loading

0 comments on commit 6d1e59c

Please sign in to comment.