-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from marctheshark3/db-dev
Db dev
- Loading branch information
Showing
20 changed files
with
6,329 additions
and
608 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.8-slim | ||
FROM python:3.9 | ||
|
||
# Set the working directory in the container | ||
WORKDIR /usr/src/app | ||
WORKDIR /app | ||
|
||
# Copy the current directory contents into the container at /usr/src/app | ||
COPY . /usr/src/app | ||
# Copy the current directory contents into the container | ||
COPY . /app | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install -r requirements.txt | ||
# Install cron and Python dependencies | ||
RUN apt-get update && apt-get -y install cron && \ | ||
pip3 install --no-cache-dir -r /app/requirements.txt | ||
|
||
# Setup cron jobs | ||
COPY utils/crontab_updates /etc/cron.d/crontab_updates | ||
RUN chmod 0644 /etc/cron.d/crontab_updates && \ | ||
crontab /etc/cron.d/crontab_updates && \ | ||
touch /var/log/cron.log | ||
|
||
# Make the entrypoint script executable and set it as the entrypoint | ||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
# Make port 8050 available to the world outside this container | ||
EXPOSE 8050 | ||
|
||
# Define environment variable | ||
ENV FLASK_APP app.py | ||
|
||
# Run the application | ||
CMD ["gunicorn", "-w", "4", "--timeout", "2000", "-b", "0.0.0.0:8050", "app:server"] | ||
# Command to run the application and cron jobs | ||
CMD ["entrypoint.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
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,29 @@ | ||
version: '3.8' | ||
|
||
services: | ||
db: | ||
image: postgres:latest | ||
environment: | ||
POSTGRES_DB: mining-db | ||
POSTGRES_USER: marctheshark | ||
POSTGRES_PASSWORD: password | ||
volumes: | ||
- mining_data:/var/lib/postgresql/data | ||
restart: unless-stopped | ||
ports: | ||
- "5431:5432" | ||
|
||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile # Make sure this is the name of your Dockerfile | ||
volumes: | ||
- ./:/app | ||
ports: | ||
- "8050:8050" | ||
restart: unless-stopped | ||
depends_on: | ||
- db | ||
|
||
volumes: | ||
mining_data: |
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 |
---|---|---|
@@ -1,8 +1,36 @@ | ||
version: '3' | ||
version: '3.8' | ||
|
||
services: | ||
pool-ui: | ||
db: | ||
image: postgres:latest | ||
environment: | ||
POSTGRES_DB: mining-db | ||
POSTGRES_USER: marctheshark | ||
POSTGRES_PASSWORD: password | ||
volumes: | ||
- mining_data:/var/lib/postgresql/data | ||
restart: unless-stopped | ||
ports: | ||
- "5431:5432" | ||
|
||
app: | ||
build: | ||
context: . | ||
volumes: | ||
- ./:/app | ||
ports: | ||
- "8050:8050" | ||
restart: unless-stopped | ||
depends_on: | ||
- db | ||
|
||
pool-ui: | ||
image: ghcr.io/marctheshark3/sigmanaut-mining-pool-ui:main | ||
ports: | ||
- "8050:8050" | ||
restart: unless-stopped | ||
depends_on: | ||
- db | ||
|
||
volumes: | ||
mining_data: |
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,12 @@ | ||
#!/bin/bash | ||
|
||
echo "Starting cron..." | ||
cron | ||
echo "Cron started." | ||
|
||
|
||
# Run the database initialization script | ||
python3 -m utils.init_db | ||
|
||
# Start the web server with gunicorn | ||
gunicorn -w 4 --timeout 2000 -b 0.0.0.0:8050 app:server |
Oops, something went wrong.