-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a mono demo image #480
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
934d7bf
added a mono demo image
i3rotlher 6e53f06
added demo
i3rotlher 66888ef
Typo
i3rotlher 40dce4c
Typo
i3rotlher 20f2aad
Updated action to trigger on test realeases
i3rotlher 1518de2
added test publish action
i3rotlher 2aa99d8
added example data script
i3rotlher 31c4bc4
readme update
i3rotlher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
FROM node:18.13 | ||
|
||
RUN apt-get update | ||
RUN yes | apt-get install wget | ||
|
||
# Set DATABASE_URI to be localhost | ||
ENV DATABASE_URI=mongodb://localhost:27017 | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# install mongoDB | ||
RUN yes | apt-get install gnupg curl | ||
RUN curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \ | ||
gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ | ||
--dearmor | ||
RUN echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list | ||
RUN apt-get update | ||
RUN apt-get install -y mongodb-org | ||
RUN mkdir /data | ||
RUN mkdir /data/db | ||
RUN mongod --fork --logpath /var/log/mongodb.log | ||
|
||
# ----- BACKEND (from /backend dockerfile) ----------------------------------------------------------------------- | ||
|
||
# install chrome | ||
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | ||
RUN yes | apt install ./google-chrome-stable_current_amd64.deb | ||
RUN rm -f google-chrome-stable_current_amd64.deb | ||
|
||
# install chromedriver | ||
RUN google-chrome --version | grep -oP '\d+\.\d+\.\d+\.\d+' > chromeversion.txt | ||
RUN apt-get install -yqq unzip curl | ||
RUN wget -O /tmp/chromedriverzip.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$(cat chromeversion.txt)/linux64/chromedriver-linux64.zip | ||
RUN unzip /tmp/chromedriverzip.zip chromedriver-linux64/chromedriver -d /usr/local/bin/ | ||
RUN mv /usr/local/bin/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver | ||
|
||
# install firefox | ||
RUN wget -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64" | ||
RUN tar xjf ~/FirefoxSetup.tar.bz2 -C /opt/ | ||
RUN ln -s /opt/firefox/firefox /usr/local/bin/ | ||
RUN apt-get update && apt-get install -y wget bzip2 libxtst6 libgtk-3-0 libx11-xcb-dev libdbus-glib-1-2 libxt6 libpci-dev && rm -rf /var/lib/apt/lists/* | ||
|
||
# install edge | ||
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | ||
RUN install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ | ||
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list' | ||
RUN rm microsoft.gpg | ||
RUN apt update && yes | apt install microsoft-edge-stable | ||
# include in path | ||
RUN export PATH=$PATH:/opt/microsoft/msedge/ | ||
ENV PATH="${PATH}:/opt/microsoft/msedge/" | ||
|
||
# install msedgedriver | ||
# # Extract the latest stable version of edge | ||
RUN msedge --version | sed 's/.*Edge \([0-9.]*\).*/\1/' > latest_stable.txt | ||
|
||
# # Remove the driver-pagehtml | ||
RUN wget -O /tmp/msedgedriver.zip https://msedgedriver.azureedge.net/$(cat latest_stable.txt)/edgedriver_linux64.zip | ||
RUN unzip /tmp/msedgedriver.zip msedgedriver -d /usr/local/bin/ | ||
RUN rm -f latest_stable.txt | ||
|
||
WORKDIR /usr/src/app/backend | ||
# Bundle app source | ||
COPY ./backend . | ||
|
||
RUN npm ci | ||
# If you are building your code for production | ||
# RUN npm ci --only=production | ||
|
||
EXPOSE 8080 | ||
|
||
# Start dbus-daemon for google-chrome | ||
RUN service dbus start | ||
|
||
# ----- FRONTEND (from /frontend dockerfile) --------------------------------------------------------------------- | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app/frontend | ||
|
||
# Copy package.json and package-lock.json | ||
COPY ./frontend/package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm ci --ignore-scripts | ||
|
||
# Install Angular CLI | ||
RUN npm install --ignore-scripts -g @angular/cli | ||
|
||
COPY ./frontend . | ||
|
||
EXPOSE 4200 | ||
EXPOSE 27017-27019 | ||
RUN npm run build | ||
|
||
# ----------------------------------------------------------------------------------------------------------------- | ||
|
||
# Create a startup script | ||
RUN echo "#!/bin/sh" > /usr/src/app/start.sh && \ | ||
echo "mongod --fork --logpath /var/log/mongodb.log" >> /usr/src/app/start.sh && \ | ||
echo "cd /usr/src/app/backend && npm run database && npm run database-examples && npm run start &" >> /usr/src/app/start.sh && \ | ||
echo "cd /usr/src/app/frontend && node server.js" >> /usr/src/app/start.sh | ||
|
||
# Make the script executable | ||
RUN chmod +x /usr/src/app/start.sh | ||
|
||
# Set the script as the ENTRYPOINT | ||
ENTRYPOINT ["/usr/src/app/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
const { exit } = require('process'); | ||
const bcrypt = require('bcrypt'); | ||
const dbService = require('./DbServices'); | ||
require('dotenv').config(); | ||
|
||
const exampleUser = '[email protected]'; | ||
const examplePassword = 'seedtest'; | ||
const exampleStory = 'Example Story'; | ||
const exampleDescription = 'Example Description'; | ||
const exampleScenario = { | ||
scenario_id: 1, | ||
name: 'Example Scenario', | ||
comment: null, | ||
stepDefinitions: { | ||
given: [ | ||
{ | ||
id: 1, | ||
mid: '', | ||
pre: 'I am on the website:', | ||
stepType: 'given', | ||
type: 'Website / URL', | ||
values: [ | ||
'https://www.youtube.com/' | ||
], | ||
isExample: [ | ||
false | ||
] | ||
} | ||
], | ||
when: [], | ||
then: [ | ||
{ | ||
id: 1, | ||
mid: '', | ||
pre: 'I take a screenshot. Optionally: Focus the page on the element', | ||
stepType: 'then', | ||
type: 'Screenshot', | ||
values: [ | ||
'' | ||
], | ||
isExample: [ | ||
false | ||
] | ||
} | ||
], | ||
example: [] | ||
}, | ||
browser: 'chrome', | ||
lastTestPassed: null | ||
}; | ||
|
||
const uri = process.env.DATABASE_URI || 'mongodb://SeedAdmin:SeedTest@localhost:27017'; | ||
|
||
async function insertExampleUser() { | ||
try { | ||
// eslint-disable-next-line max-len | ||
const result = await dbService.registerUser({ email: exampleUser, password: bcrypt.hashSync(examplePassword, bcrypt.genSaltSync(10)) }); | ||
console.log('\x1b[32mExample-User inserted! \n\x1b[0m'); | ||
return result; | ||
} catch (error) { | ||
console.log(`\x1b[31m${error} \x1b[0m`); | ||
return dbService.getUserByEmail(exampleUser); | ||
} | ||
} | ||
|
||
async function insertExampleTest(user) { | ||
try { | ||
// createRepository | ||
const repoId = await dbService.createRepo(user.insertedId, 'Test Repo'); | ||
console.log('\x1b[32mExample-Repo inserted! \n\x1b[0m'); | ||
// createStory | ||
const storyId = await dbService.createStory(exampleStory, exampleDescription, repoId); | ||
await dbService.insertStoryIdIntoRepo(storyId, repoId); | ||
console.log('\x1b[32mExample-Story inserted! \n\x1b[0m'); | ||
// fillTestScenario | ||
await dbService.updateScenario(storyId, exampleScenario); | ||
console.log('\x1b[32mExample-Scenario-Data inserted! \n\x1b[0m'); | ||
} catch (error) { | ||
console.log(`\x1b[31m${error} \x1b[0m`); | ||
} | ||
} | ||
|
||
async function insertExampleData() { | ||
// wait to give establishConnection enough time to establish connection xD | ||
await new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 1500); | ||
}); | ||
console.log(`\x1b[33mSetting Up DB-Exampel-Data in: ${uri}\n\x1b[0m`); | ||
console.log('\x1b[34mInserting Example User: \x1b[0m'); | ||
const user = await insertExampleUser(); | ||
console.log('\x1b[34mInserting Example Test: \x1b[0m'); | ||
await insertExampleTest(user); | ||
console.log('\x1b[32mExample-Data set up! \x1b[0m'); | ||
} | ||
|
||
insertExampleData().then(() => { | ||
exit(); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
exit(1); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / SonarCloud
MongoDB database passwords should not be disclosed