security updates part 2
This commit is contained in:
parent
e1ab786140
commit
d5e7de8f50
137
Jenkinsfile
vendored
Normal file
137
Jenkinsfile
vendored
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
parallel {
|
||||||
|
stages {
|
||||||
|
stage('Start API') {
|
||||||
|
steps {
|
||||||
|
sh '''docker image prune -f
|
||||||
|
docker build --no-cache -t fbla-api .
|
||||||
|
docker-compose down
|
||||||
|
docker-compose up -d'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Run Tests') {
|
||||||
|
steps {
|
||||||
|
sh '''dart pub install
|
||||||
|
dart run ./test/fbla_api_test.dart'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Flutter Cleanup') {
|
||||||
|
steps {
|
||||||
|
sh '''flutter upgrade --force
|
||||||
|
flutter pub upgrade
|
||||||
|
flutter --version
|
||||||
|
flutter doctor
|
||||||
|
flutter clean'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build') {
|
||||||
|
parallel {
|
||||||
|
stage('Web Build') {
|
||||||
|
steps {
|
||||||
|
sh 'flutter build web --release --base-href /fbla/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build Linux') {
|
||||||
|
steps {
|
||||||
|
sh 'flutter build linux --release'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build APK') {
|
||||||
|
steps {
|
||||||
|
sh 'flutter build apk --release'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy and Save') {
|
||||||
|
parallel {
|
||||||
|
stage('Deploy Web Local') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def remote = [
|
||||||
|
name: 'HostServer',
|
||||||
|
host: '192.168.0.216',
|
||||||
|
user: '${env.JOBLINK_LOCAL_USER}',
|
||||||
|
password: '${env.JOBLINK_LOCAL_PASSWD}',
|
||||||
|
allowAnyHosts: true,
|
||||||
|
]
|
||||||
|
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/webfiles/fbla', remote: remote)
|
||||||
|
sshPut(from: 'build/web/', into: '/home/${env.JOBLINK_LOCAL_USER}/fbla-webserver', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/web /home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/webfiles/fbla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Save Other Builds') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def remote = [
|
||||||
|
name: 'HostServer',
|
||||||
|
host: '192.168.0.216',
|
||||||
|
user: '${env.JOBLINK_LOCAL_USER}',
|
||||||
|
password: '${env.JOBLINK_LOCAL_PASSWD}',
|
||||||
|
allowAnyHosts: true,
|
||||||
|
]
|
||||||
|
if(env.BRANCH_NAME == 'main') {
|
||||||
|
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/linux', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux"
|
||||||
|
sshPut(from: 'build/linux/x64/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/linux', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux"
|
||||||
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux/release/"
|
||||||
|
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/apk', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk"
|
||||||
|
sshPut(from: 'build/app/outputs/apk/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/apk', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk"
|
||||||
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk/release/"
|
||||||
|
} else {
|
||||||
|
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux"
|
||||||
|
sshPut(from: 'build/linux/x64/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux"
|
||||||
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux/release/"
|
||||||
|
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk"
|
||||||
|
sshPut(from: 'build/app/outputs/apk/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk"
|
||||||
|
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk/release/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy Remote') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
env.BRANCH_NAME == 'main'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def remote = [
|
||||||
|
name: 'MarinoDev',
|
||||||
|
host: 'marinodev.com',
|
||||||
|
port: 21098,
|
||||||
|
user: '${env.JOBLINK_REMOTE_USER}',
|
||||||
|
identityFile: '/var/jenkins_home/marinoDevPrivateKey',
|
||||||
|
passphrase: '${env.JOBLINK_REMOTE_PASSWD}',
|
||||||
|
allowAnyHosts: true,
|
||||||
|
]
|
||||||
|
sshRemove(path: '/home/${env.JOBLINK_REMOTE_USER}/public_html/fbla', remote: remote)
|
||||||
|
sshPut(from: '/var/jenkins_home/workspace/fbla-ui_main/build/web/', into: '/home/${env.JOBLINK_REMOTE_USER}/public_html/', remote: remote)
|
||||||
|
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_REMOTE_USER}/public_html/web /home/${env.JOBLINK_REMOTE_USER}/public_html/fbla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -24,7 +24,7 @@ It uses the [Flutter Framework](https://flutter.dev/) for the front end and the
|
|||||||
- Stable internet connection.
|
- Stable internet connection.
|
||||||
|
|
||||||
### API
|
### API
|
||||||
- **OS**: Windows, Linux, MacOS
|
- **OS**: Windows, Linux, MacOS.
|
||||||
- Stable internet connection.
|
- Stable internet connection.
|
||||||
|
|
||||||
## Installation/Usage
|
## Installation/Usage
|
||||||
@ -33,7 +33,7 @@ Please view the README in [fbla_ui](fbla_ui/README.md) and [fbla-api](fbla-api/R
|
|||||||
|
|
||||||
## Competitions
|
## Competitions
|
||||||
|
|
||||||
[Here](https://docs.google.com/presentation/d/1ZbSE9RqobU2T-NDIm3CUtT_9nEhOm3_B47NZl1-c_QA) is the presentation used for competitions
|
[Here](https://docs.google.com/presentation/d/1ZbSE9RqobU2T-NDIm3CUtT_9nEhOm3_B47NZl1-c_QA) is the presentation used for competitions.
|
||||||
|
|
||||||
### WI State Leadership Conference
|
### WI State Leadership Conference
|
||||||
|
|
||||||
|
|||||||
1
fbla-api/Jenkinsfile
vendored
1
fbla-api/Jenkinsfile
vendored
@ -16,6 +16,5 @@ docker-compose up -d'''
|
|||||||
dart run ./test/fbla_api_test.dart'''
|
dart run ./test/fbla_api_test.dart'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,15 +2,15 @@ This is the API for my 2023-2024 FBLA Coding & Programming App
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Install [Dart SDK](https://dart.dev/get-dart)
|
1. Install [Dart SDK](https://dart.dev/get-dart).
|
||||||
2. Clone the repo
|
2. Clone the repo .
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.marinodev.com/MarinoDev/FBLA24.git
|
git clone https://git.marinodev.com/MarinoDev/FBLA24.git
|
||||||
cd FBLA24/fbla-api/
|
cd FBLA24/fbla-api/
|
||||||
```
|
```
|
||||||
3. Run `dart pub install` to install dart packages
|
3. Run `dart pub install` to install dart packages.
|
||||||
4. Install [PostgreSQL](https://www.postgresql.org/) and set it up.
|
4. Install [PostgreSQL](https://www.postgresql.org/) and set it up.
|
||||||
5. Create `fbla` database in postgres
|
5. Create `fbla` database in postgres.
|
||||||
```SQL
|
```SQL
|
||||||
CREATE DATABASE fbla
|
CREATE DATABASE fbla
|
||||||
WITH
|
WITH
|
||||||
@ -21,7 +21,7 @@ CREATE DATABASE fbla
|
|||||||
```
|
```
|
||||||
Make sure to change [username] to the actual username of your postgres instance.
|
Make sure to change [username] to the actual username of your postgres instance.
|
||||||
|
|
||||||
6. Create `businesses` table
|
6. Create `businesses` table.
|
||||||
```SQL
|
```SQL
|
||||||
-- Table: public.businesses
|
-- Table: public.businesses
|
||||||
|
|
||||||
@ -48,8 +48,9 @@ TABLESPACE pg_default;
|
|||||||
ALTER TABLE IF EXISTS public.businesses
|
ALTER TABLE IF EXISTS public.businesses
|
||||||
OWNER to [username];
|
OWNER to [username];
|
||||||
```
|
```
|
||||||
Make sure to change [username] to the actual username of your postgres instance
|
Make sure to change [username] to the actual username of your postgres instance.
|
||||||
7. Create `users` table
|
|
||||||
|
7. Create `users` table.
|
||||||
```SQL
|
```SQL
|
||||||
-- Table: public.users
|
-- Table: public.users
|
||||||
|
|
||||||
@ -70,8 +71,8 @@ ALTER TABLE IF EXISTS public.users
|
|||||||
OWNER to postgres;
|
OWNER to postgres;
|
||||||
```
|
```
|
||||||
8. Set environment variables `JOBLINK_POSTGRES_ADDRESS` (IP address), `JOBLINK_POSTGRES_PORT` (default 5432), `JOBLINK_POSTGRES_USERNAME`, and `JOBLINK_POSTGRES_PASSWORD` to appropriate information for your postgres database. Also set `JOBLINK_SECRET_KEY` to anything you want to generate JSON Web Tokens.
|
8. Set environment variables `JOBLINK_POSTGRES_ADDRESS` (IP address), `JOBLINK_POSTGRES_PORT` (default 5432), `JOBLINK_POSTGRES_USERNAME`, and `JOBLINK_POSTGRES_PASSWORD` to appropriate information for your postgres database. Also set `JOBLINK_SECRET_KEY` to anything you want to generate JSON Web Tokens.
|
||||||
9. Set lib/create_first_user.dart username and password variables at top of file and run with `dart run lib/create_first_user.dart`
|
9. Set lib/create_first_user.dart username and password variables at top of file and run with `dart run lib/create_first_user.dart`.\
|
||||||
Note: the username and password you use here will be what you use to log into the app as an admin
|
Note: the username and password you use here will be what you use to log into the app as an admin.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
121
fbla_ui/Jenkinsfile
vendored
121
fbla_ui/Jenkinsfile
vendored
@ -1,125 +1,4 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
stages {
|
|
||||||
stage('Flutter Cleanup') {
|
|
||||||
steps {
|
|
||||||
sh '''flutter upgrade --force
|
|
||||||
flutter pub upgrade
|
|
||||||
flutter --version
|
|
||||||
flutter doctor
|
|
||||||
flutter clean'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build') {
|
|
||||||
parallel {
|
|
||||||
stage('Web Build') {
|
|
||||||
steps {
|
|
||||||
sh 'flutter build web --release --base-href /fbla/'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build Linux') {
|
|
||||||
steps {
|
|
||||||
sh 'flutter build linux --release'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build APK') {
|
|
||||||
steps {
|
|
||||||
sh 'flutter build apk --release'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Deploy and Save') {
|
|
||||||
parallel {
|
|
||||||
stage('Deploy Web Local') {
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
def remote = [
|
|
||||||
name: 'HostServer',
|
|
||||||
host: '192.168.0.216',
|
|
||||||
user: '${env.JOBLINK_LOCAL_USER}',
|
|
||||||
password: '${env.JOBLINK_LOCAL_PASSWD}',
|
|
||||||
allowAnyHosts: true,
|
|
||||||
]
|
|
||||||
sshRemove(path: '/home/fbla/fbla-webserver/webfiles/fbla', remote: remote)
|
|
||||||
sshPut(from: 'build/web/', into: '/home/fbla/fbla-webserver', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mv /home/fbla/fbla-webserver/web /home/fbla/fbla-webserver/webfiles/fbla"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Save Other Builds') {
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
def remote = [
|
|
||||||
name: 'HostServer',
|
|
||||||
host: '192.168.0.216',
|
|
||||||
user: 'fbla',
|
|
||||||
password: 'fbla',
|
|
||||||
allowAnyHosts: true,
|
|
||||||
]
|
|
||||||
if(env.BRANCH_NAME == 'main') {
|
|
||||||
sshRemove(path: '/home/fbla/builds/main/linux', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mkdir /home/fbla/builds/main/linux"
|
|
||||||
sshPut(from: 'build/linux/x64/release', into: '/home/fbla/builds/main/linux', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mv /home/fbla/builds/main/linux/release/* /home/fbla/builds/main/linux"
|
|
||||||
sshCommand remote: remote, command: "rm -R /home/fbla/builds/main/linux/release/"
|
|
||||||
sshRemove(path: '/home/fbla/builds/main/apk', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mkdir /home/fbla/builds/main/apk"
|
|
||||||
sshPut(from: 'build/app/outputs/apk/release', into: '/home/fbla/builds/main/apk', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mv /home/fbla/builds/main/apk/release/* /home/fbla/builds/main/apk"
|
|
||||||
sshCommand remote: remote, command: "rm -R /home/fbla/builds/main/apk/release/"
|
|
||||||
} else {
|
|
||||||
sshRemove(path: '/home/fbla/builds/dev/linux', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mkdir /home/fbla/builds/dev/linux"
|
|
||||||
sshPut(from: 'build/linux/x64/release', into: '/home/fbla/builds/dev/linux', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mv /home/fbla/builds/dev/linux/release/* /home/fbla/builds/dev/linux"
|
|
||||||
sshCommand remote: remote, command: "rm -R /home/fbla/builds/dev/linux/release/"
|
|
||||||
sshRemove(path: '/home/fbla/builds/dev/apk', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mkdir /home/fbla/builds/dev/apk"
|
|
||||||
sshPut(from: 'build/app/outputs/apk/release', into: '/home/fbla/builds/dev/apk', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mv /home/fbla/builds/dev/apk/release/* /home/fbla/builds/dev/apk"
|
|
||||||
sshCommand remote: remote, command: "rm -R /home/fbla/builds/dev/apk/release/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Deploy Remote') {
|
|
||||||
when {
|
|
||||||
expression {
|
|
||||||
env.BRANCH_NAME == 'main'
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
def remote = [
|
|
||||||
name: 'MarinoDev',
|
|
||||||
host: 'marinodev.com',
|
|
||||||
port: 21098,
|
|
||||||
user: '${env.JOBLINK_REMOTE_USER}',
|
|
||||||
identityFile: '/var/jenkins_home/marinoDevPrivateKey',
|
|
||||||
passphrase: '${env.JOBLINK_REMOTE_PASSWD}',
|
|
||||||
allowAnyHosts: true,
|
|
||||||
]
|
|
||||||
sshRemove(path: '/home/mariehdi/public_html/fbla', remote: remote)
|
|
||||||
sshPut(from: '/var/jenkins_home/workspace/fbla-ui_main/build/web/', into: '/home/mariehdi/public_html/', remote: remote)
|
|
||||||
sshCommand remote: remote, command: "mv /home/mariehdi/public_html/web /home/mariehdi/public_html/fbla"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user