-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
179 additions
and
13 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 |
---|---|---|
|
@@ -5,6 +5,10 @@ SHELL ["/bin/bash", "-c"] | |
# Clone SpiceQL repo instead of copying? | ||
#git clone [email protected]:DOI-USGS/SpiceQL.git /repo | ||
|
||
# RUN git clone https://github.com/DOI-USGS/SpiceQL.git /repo --recursive | ||
# RUN echo $(ls /repo) | ||
# RUN chmod -R 755 /repo | ||
|
||
RUN mkdir /repo | ||
COPY . /repo | ||
RUN echo $(ls /repo) | ||
|
@@ -18,20 +22,31 @@ ENV SSPICE_DEBUG=TRUE | |
ENV SPICEROOT=/mnt/isis_data | ||
ENV SPICEQL_LOG_LEVEL=TRACE | ||
|
||
RUN apt-get update && apt-get install build-essential -y | ||
|
||
# CMD ["/bin/bash"] | ||
# RUN /bin/bash -c "source activate spiceql" | ||
RUN mamba env create -f ${SPICEQL_REPO_ROOT}/environment.yml -n spiceql && \ | ||
source /opt/conda/etc/profile.d/conda.sh && \ | ||
conda init && \ | ||
conda activate spiceql && \ | ||
conda install -c conda-forge spiceql && \ | ||
echo "source activate spiceql" > ~/.bashrc && \ | ||
cd ${SPICEQL_REPO_ROOT}/fastapi | ||
|
||
# conda install -c conda-forge spiceql && \ | ||
echo "source activate spiceql" > ~/.bashrc && \ | ||
conda activate spiceql && \ | ||
cd $SPICEQL_REPO_ROOT && mkdir -p build && cd build && \ | ||
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DSPICEQL_BUILD_TESTS=OFF && \ | ||
make install | ||
|
||
RUN cd ${SPICEQL_REPO_ROOT}/fastapi | ||
ENV PATH /opt/conda/envs/spiceql/bin:$PATH | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update | ||
RUN apt-get install nginx curl -y | ||
COPY fastapi/config/nginx.conf /etc/nginx/nginx.conf | ||
|
||
WORKDIR ${SPICEQL_REPO_ROOT}/fastapi | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT [ "uvicorn", "app.main:app", "--reload", "--port" , "8080" ] | ||
CMD nginx && uvicorn app.main:app --reload --port 8080 |
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,156 @@ | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: spiceql | ||
Resources: | ||
SpiceQLECSLaunchTemplate: | ||
Type: AWS::EC2::LaunchTemplate | ||
DependsOn: ECSCluster | ||
Properties: | ||
LaunchTemplateData: | ||
ImageId: /aws/service/ecs/optimized-ami/amazon-linux-2/kernel-5.10/recommended/image_id | ||
KeyName: AscEc2DevKey | ||
IamInstanceProfile: | ||
Arn: !Ref 'IamRoleInstanceProfile' | ||
BlockDeviceMappings: | ||
- DeviceName: /dev/xvda | ||
Ebs: | ||
VolumeSize: '5000' | ||
UserData: !Base64 | ||
Fn::Sub: | ||
- "#!/bin/bash \necho ECS_CLUSTER=${ClusterName} >> /etc/ecs/ecs.config;" | ||
- ClusterName: !Ref 'ECSClusterName' | ||
SpiceQLProdLogGroupSlot1: | ||
Type: 'AWS::Logs::LogGroup' | ||
Properties: | ||
LogGroupName: spiceql_prod_slot1_log_group | ||
Metadata: | ||
'AWS::CloudFormation::Designer': | ||
id: e9e7c015-1dda-480c-98e4-c4795d48e148 | ||
SpiceQLProdTaskDefSlot1: | ||
Type: 'AWS::ECS::TaskDefinition' | ||
Properties: | ||
RequiresCompatibilities: | ||
- FARGATE | ||
ExecutionRoleArn: 'arn:aws:iam::950438895271:role/csr-EcsTask-Role' | ||
Cpu: 4096 | ||
Memory: 8192 | ||
NetworkMode: awsvpc | ||
ContainerDefinitions: | ||
- Name: spiceql_prod_slot1_container | ||
Image: '950438895271.dkr.ecr.us-west-2.amazonaws.com/spiceql:dev' | ||
PortMappings: | ||
- ContainerPort: 80 | ||
LogConfiguration: | ||
LogDriver: awslogs | ||
Options: | ||
awslogs-region: !Ref 'AWS::Region' | ||
awslogs-group: !Ref SpiceQLProdLogGroupSlot1 | ||
awslogs-stream-prefix: ecs | ||
Environment: | ||
- Name: SPICEROOT | ||
Value: /isis_data | ||
- Name: SPICEQL_LOG_LEVEL | ||
Value: DEBUG | ||
- Name: SSPICE_DEBUG | ||
Value: TRUE | ||
SpiceQLProdECSClusterSlot1: | ||
Type: 'AWS::ECS::Cluster' | ||
Properties: | ||
ClusterName: spiceqlProdCluster_slot1 | ||
ClusterSettings: | ||
- Name: containerInsights | ||
Value: enabled | ||
SpiceQLProdLBSlot1: | ||
Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer' | ||
Properties: | ||
Name: spiceql-prod-slot1-LB | ||
Scheme: internal | ||
Subnets: | ||
- subnet-0567fccf47f9b29a0 | ||
- subnet-0326c18b7c38caa73 | ||
Type: application | ||
SecurityGroups: | ||
- !GetAtt SpiceQLProdLBSGSlot1.GroupId | ||
SpiceQLProdTGSlot1: | ||
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup' | ||
Properties: | ||
Name: spiceql-prod-slot1-TG | ||
VpcId: vpc-004f1e36134bcaa04 | ||
Protocol: HTTP | ||
Port: 80 | ||
TargetType: ip | ||
HealthCheckPath: / | ||
SpiceQLProdListenerSlot1: | ||
Type: 'AWS::ElasticLoadBalancingV2::Listener' | ||
Properties: | ||
DefaultActions: | ||
- TargetGroupArn: !Ref SpiceQLProdTGSlot1 | ||
Type: forward | ||
LoadBalancerArn: !Ref SpiceQLProdLBSlot1 | ||
Port: 443 | ||
Protocol: HTTPS | ||
SslPolicy: ELBSecurityPolicy-FS-1-2-Res-2020-10 | ||
Certificates: | ||
- CertificateArn: >- | ||
arn:aws:acm:us-west-2:950438895271:certificate/6aa50410-fb5a-4300-888f-55aae14463df | ||
SpiceQLProdLBSGSlot1: | ||
Type: 'AWS::EC2::SecurityGroup' | ||
Properties: | ||
VpcId: vpc-004f1e36134bcaa04 | ||
GroupDescription: SG for the Fargate ALB | ||
GroupName: spiceql-prod-slot1-LBSG | ||
SecurityGroupIngress: | ||
- CidrIpv6: '::/0' | ||
FromPort: 80 | ||
ToPort: 443 | ||
IpProtocol: TCP | ||
Description: Inbound rule for IPv6 traffic | ||
- CidrIp: 0.0.0.0/0 | ||
FromPort: 80 | ||
ToPort: 443 | ||
IpProtocol: TCP | ||
Description: Inbound rule for IPv4 traffic | ||
SpiceQLProdContainerSGSlot1: | ||
Type: 'AWS::EC2::SecurityGroup' | ||
Properties: | ||
GroupName: spiceql_prod_slot1_sg | ||
GroupDescription: Security group for NGINX container | ||
VpcId: vpc-004f1e36134bcaa04 | ||
SecurityGroupIngress: | ||
- IpProtocol: -1 | ||
SourceSecurityGroupId: !GetAtt SpiceQLProdLBSGSlot1.GroupId | ||
Description: Inbound rule for all traffic | ||
SpiceQLProdDNSSlot1: | ||
Type: 'AWS::Route53::RecordSet' | ||
Properties: | ||
HostedZoneName: prod-asc.chs.usgs.gov. | ||
Name: spiceql-slot1.prod-asc.chs.usgs.gov | ||
Type: A | ||
AliasTarget: | ||
HostedZoneId: !GetAtt SpiceQLProdLBSlot1.CanonicalHostedZoneID | ||
DNSName: !GetAtt SpiceQLProdLBSlot1.DNSName | ||
SpiceQLProdECSServiceSlot1: | ||
Type: 'AWS::ECS::Service' | ||
DependsOn: | ||
- SpiceQLProdListenerSlot1 | ||
Properties: | ||
LaunchType: FARGATE | ||
Cluster: | ||
Ref: SpiceQLProdECSClusterSlot1 | ||
DesiredCount: 20 | ||
TaskDefinition: | ||
Ref: SpiceQLProdTaskDefSlot1 | ||
DeploymentConfiguration: | ||
MaximumPercent: 100 | ||
MinimumHealthyPercent: 0 | ||
NetworkConfiguration: | ||
AwsvpcConfiguration: | ||
AssignPublicIp: DISABLED | ||
SecurityGroups: | ||
- !GetAtt SpiceQLProdContainerSGSlot1.GroupId | ||
Subnets: | ||
- subnet-0326c18b7c38caa73 | ||
LoadBalancers: | ||
- TargetGroupArn: | ||
Ref: SpiceQLProdTGSlot1 | ||
ContainerPort: 80 | ||
ContainerName: spiceql_prod_slot1_container |
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