Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5902c34
changes
jonnygovish Jun 24, 2020
bc9f8df
procfile
jonnygovish Jun 24, 2020
47b51dc
db name
jonnygovish Jun 24, 2020
7a239b5
Add a test file
jonnygovish Aug 6, 2020
ef7fadf
config file for the database
jonnygovish Aug 6, 2020
3892250
Add new dependencies
jonnygovish Aug 6, 2020
22d3625
add config
jonnygovish Aug 6, 2020
c4e2a3b
database config
jonnygovish Aug 7, 2020
6d3af18
Update _config.js
brianmarete Aug 13, 2020
67ae1a8
Update serverTest.js
brianmarete Aug 13, 2020
4f35c3b
Update package.json
brianmarete Aug 13, 2020
f01d53e
Update _config.js
brianmarete Aug 13, 2020
18ece3b
Update _config.js
brianmarete Aug 13, 2020
14c4e4d
initial commit
nancynaomy Sep 20, 2025
a6e2c9e
Add MILESTONE 2 banner to landing page and make app read MONGO_URI fr…
nancynaomy Sep 21, 2025
118f940
Add Dockerfile and dockerignore
nancynaomy Sep 21, 2025
445decd
Fix server.js syntax and update Jenkins pipeline
nancynaomy Sep 21, 2025
8956c02
Add MILESTONE 2 to landing page
nancynaomy Sep 22, 2025
91dcb9c
Milestone 2: basic pipeline and landing page update
nancynaomy Sep 22, 2025
2c25248
Add MILESTONE 3 to landing page
nancynaomy Sep 22, 2025
21690d8
Updated Jenkinsfile: added tests, deploy, and Slack notifications
nancynaomy Sep 22, 2025
96eca32
Setup MongoDB Atlas config + add MILESTONE 2 banner
nancynaomy Sep 25, 2025
d3492f6
Setup MongoDB Atlas config + add MILESTONE 2 banner
nancynaomy Sep 26, 2025
1b029e7
Merge branch 'milestone2'
nancynaomy Sep 26, 2025
f77a2fa
Work in progress: milestone 2 changes
nancynaomy Sep 26, 2025
846248e
Fixed my landing page
nancynaomy Sep 27, 2025
4850948
added .env to git ignore
nancynaomy Sep 27, 2025
23a1efa
made changes on server.js on test branch
nancynaomy Sep 27, 2025
b40d9af
updated my configs on test
nancynaomy Sep 27, 2025
d05d3c3
fixed test
nancynaomy Sep 27, 2025
5a14fe2
package update
nancynaomy Sep 27, 2025
e385a3e
merged test to master
nancynaomy Sep 27, 2025
1bfac2e
added mile stone 2
nancynaomy Sep 27, 2025
67e1cf8
uodated Jenkinsfile to send slack notification
nancynaomy Sep 27, 2025
d5e7a60
update Jenkin to push notification to slack
nancynaomy Sep 27, 2025
f5de56d
Updated MILESTONE 4
nancynaomy Sep 27, 2025
937b70c
added read me for documentation
nancynaomy Sep 27, 2025
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
3 changes: 3 additions & 0 deletions .app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test('basic math works', () => {
expect(2 + 2).toBe(4);
});
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Node dependencies
node_modules
npm-debug.log
yarn-error.log

# Environment files
.env
.env.local
.env.*.local

# Git files
.git
.gitignore

# Docker files (no need inside the image)
Dockerfile
.dockerignore

# OS/system junk
*.swp
*.swo
.DS_Store
Thumbs.db
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MONGOUSER=joan
MONGOPASSWORD=j0j0wWords.
MONGOHOST=joan-gallery.3axbpux.mongodb.net
MONGODATABASE=darkroom
MONGOPRODUCTIONDATABASE=darkroom
MONGODEVDATABASE=darkroom-dev
MONGOTESTDATABASE=darkroom-test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules/
.env
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18

WORKDIR /app

COPY package*.json ./
RUN npm install --production

COPY . .

EXPOSE 3000

# Command to start the server
CMD ["node", "server"]
63 changes: 63 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
pipeline {
agent any

tools {
nodejs 'nodeJS22'
}

triggers {
githubPush()
}

stages {
stage('Checkout') {
steps {
git branch: 'master', url: 'https://github.com/nancynaomy/gallery.git'
}
}

stage('Install Dependencies') {
steps {
sh 'npm install'
}
}

stage('Build') {
steps {
sh 'npm run build || echo "No build step"'
}
}

stage('Deploy to Render') {
steps {
withCredentials(
[string
(credentialsId: 'render-webhook', variable: 'DEPLOYHOOK')
]
) {
sh 'curl -X POST $DEPLOYHOOK'
}
}
}
}

post {
success {
slackSend(
channel: '#nancy_ip1',
tokenCredentialId: 'slack',
color: 'good',
message: "SUCCESS: ${env.JOB_NAME} #${env.BUILD_NUMBER} deployed to Render.\nView app: https://gallery-7io0.onrender.com\n${env.BUILD_URL}"
)
}

failure {
slackSend(
channel: '#paul_ip1',
tokenCredentialId: 'slack',
color: 'danger',
message: "FAILURE: ${env.JOB_NAME} #${env.BUILD_NUMBER} failed.\n${env.BUILD_URL}"
)
}
}
}
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node server.js
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Gallery

A simple image gallery web application built with Node.js and Express. This project allows users to view, upload, and manage images through a web interface.

## Website
You can try the live demo here: [Live Demo](https://https://gallery2-8u49.onrender.com/)

## Features
- View a gallery of images
- Upload new images
- View single image details
- Responsive design with CSS
- RESTful routes for image management

## Project Structure
```
_config.js # Custom configuration
Dockerfile # Docker container setup
Jenkinsfile # CI/CD pipeline configuration
package.json # Project metadata and dependencies
Procfile # Process definition for deployment
server.js # Main server file
models/ # Mongoose models
public/ # Static assets (CSS, JS, images)
routes/ # Express route handlers
test/ # Test files
views/ # EJS templates
```

## Getting Started

### Prerequisites
- Node.js (v14 or higher recommended)
- npm

### Installation
1. Clone the repository:
```bash
git clone https://github.com/nancynaomy/gallery.git
cd gallery
```

2. Install dependencies:
```bash
## Website
You can try the live demo here: [Live Demo](https://https://gallery2-8u49.onrender.com/)

### Running with Docker
Build and run the Docker container:
```bash
docker build -t gallery-app .
docker run -p 3000:3000 gallery-app
```

### Testing
Run tests with:
```bash
npm test
```

## Deployment
- Deployed to render.
- The `Jenkinsfile` provides a sample CI/CD pipeline for Jenkins.

## Configuration
- Application-specific settings can be found in `_config.js`.
- Environment variables can be set for production use.

## License
This project is free to use.
17 changes: 13 additions & 4 deletions _config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
require('dotenv').config();
var config = {}

const {username = process.env.MONGOUSER,
userpassword = process.env.MONGOPASSWORD,
mongocluster = process.env.MONGOHOST,
prod_env = process.env.MONGOPRODUCTIONDATABASE,
dev_env = process.env.MONGODEVDATABASE,
test_env = process.env.MONGOTESTDATABASE} = process.env;

// Update to have your correct username and password
config.mongoURI = {
production: 'mongodb+srv://<USERNAME>:<PASSWORD>@gallery.wc344.mongodb.net/darkroom?retryWrites=true&w=majority',
development: 'mongodb+srv://<USERNAME>:<PASSWORD>@gallery.wc344.mongodb.net/darkroom-dev?retryWrites=true&w=majority',
test: 'mongodb+srv://<USERNAME>:<PASSWORD>@gallery.wc344.mongodb.net/darkroom-test?retryWrites=true&w=majority',
production: `mongodb+srv://${username}:${userpassword}@${mongocluster}/${prod_env}?retryWrites=true&w=majority`,
development: `mongodb+srv://${username}:${userpassword}@${mongocluster}/${dev_env}?retryWrites=true&w=majority`,
test: `mongodb+srv://${username}:${userpassword}@${mongocluster}/${test_env}?retryWrites=true&w=majority`,

}
module.exports = config;
module.exports = config;
Loading